From 38d82f6564f4704499da626f290fee53c5d7b889 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 25 Apr 2010 00:57:50 -0400 Subject: [PATCH] Bug Fix - Deleting a task no longer clobbers any recorded end date (thanks to Seneca Cunningham). --- AUTHORS | 1 + ChangeLog | 2 ++ src/command.cpp | 20 +++++++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index dd28e4352..be39f8eaa 100644 --- a/AUTHORS +++ b/AUTHORS @@ -46,4 +46,5 @@ Thanks to the following, who submitted detailed bug reports and excellent sugges Joe Pulliam Juergen Daubert Rich Mintz + Seneca Cunningham diff --git a/ChangeLog b/ChangeLog index 8644d9551..936503256 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ + Updated task-faq.5 man page. + The 'edit' command now conveniently fills in the current date for new annotations. + + Deleting a task no longer clobbers any recorded end date (thanks to + Seneca Cunningham). ------ old releases ------------------------------ diff --git a/src/command.cpp b/src/command.cpp index 88aab23b8..627ac1f3f 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -943,7 +943,12 @@ int handleDelete (std::string &outs) sibling->get ("uuid") == parent) { sibling->setStatus (Task::deleted); - sibling->set ("end", endTime); + + // Don't want a 'delete' to clobber the end date that may have + // been written by a 'done' command. + if (! sibling->has ("end")) + sibling->set ("end", endTime); + context.tdb.update (*sibling); if (context.config.getBoolean ("echo.command")) @@ -962,7 +967,11 @@ int handleDelete (std::string &outs) task->setStatus (Task::deleted); updateRecurrenceMask (all, *task); - task->set ("end", endTime); + // Don't want a 'delete' to clobber the end date that may have + // been written by a 'done' command. + if (! task->has ("end")) + task->set ("end", endTime); + context.tdb.update (*task); out << "Deleting recurring task " @@ -976,7 +985,12 @@ int handleDelete (std::string &outs) else { task->setStatus (Task::deleted); - task->set ("end", endTime); + + // Don't want a 'delete' to clobber the end date that may have + // been written by a 'done' command. + if (! task->has ("end")) + task->set ("end", endTime); + context.tdb.update (*task); if (context.config.getBoolean ("echo.command"))