From 2886151e64d0a6603ca0109acf2ed69c14f32087 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 3 Sep 2011 11:14:59 -0400 Subject: [PATCH] Commands - done - Converted the 'done' command to TDB2. This has a negative impact on unit tests, but that represents bugs and ommissions in TDB2, not flaws in the 'done' command. --- src/commands/CmdDone.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/commands/CmdDone.cpp b/src/commands/CmdDone.cpp index b7df8e7af..69d874298 100644 --- a/src/commands/CmdDone.cpp +++ b/src/commands/CmdDone.cpp @@ -54,14 +54,9 @@ int CmdDone::execute (std::string& output) int count = 0; std::stringstream out; - std::vector tasks; - context.tdb.lock (context.config.getBoolean ("locking")); - context.tdb.loadPending (tasks); - // Apply filter. std::vector filtered; - filter (tasks, filtered); - + filter (filtered); if (filtered.size () == 0) { context.footnote (STRING_FEEDBACK_NO_TASKS_SP); @@ -83,11 +78,7 @@ int CmdDone::execute (std::string& output) task->getStatus () == Task::waiting) { Task before (*task); - modify_task_annotate (*task, modifications); - apply_defaults (*task); - - task->setEnd (); task->setStatus (Task::completed); // Stop the task, if started. @@ -95,14 +86,11 @@ int CmdDone::execute (std::string& output) context.config.getBoolean ("journal.time")) task->addAnnotation (context.config.get ("journal.time.stop.annotation")); - // Only allow valid tasks. - task->validate (); - if (taskDiff (before, *task)) { if (permission.confirmed (before, taskDifferences (before, *task) + STRING_CMD_DONE_PROCEED)) { - context.tdb.update (*task); + context.tdb2.modify (*task); ++count; if (context.config.getBoolean ("echo.command")) @@ -127,10 +115,7 @@ int CmdDone::execute (std::string& output) } } - if (count) - context.tdb.commit (); - - context.tdb.unlock (); + context.tdb2.commit (); if (context.config.getBoolean ("echo.command")) out << format ((count == 1