Logic Bug

- Fixed logic bug with bulk and recurring task denotations.
This commit is contained in:
Paul Beckingham 2011-10-12 00:30:17 -04:00
parent afe7cbef91
commit 4feb1e2121

View file

@ -25,13 +25,13 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete. #define L10N // Localization complete.
#include <sstream> #include <sstream>
#include <Context.h> #include <Context.h>
#include <Permission.h> #include <Permission.h>
#include <text.h> #include <text.h>
#include <util.h>
#include <i18n.h> #include <i18n.h>
#include <main.h> #include <main.h>
#include <CmdDenotate.h> #include <CmdDenotate.h>
@ -54,6 +54,7 @@ int CmdDenotate::execute (std::string& output)
int rc = 0; int rc = 0;
int count = 0; int count = 0;
std::stringstream out; std::stringstream out;
bool sensitive = context.config.getBoolean ("search.case.sensitive");
// Apply filter. // Apply filter.
std::vector <Task> filtered; std::vector <Task> filtered;
@ -64,8 +65,6 @@ int CmdDenotate::execute (std::string& output)
return 1; return 1;
} }
bool sensitive = context.config.getBoolean ("search.case.sensitive");
// Apply the command line modifications to the completed task. // Apply the command line modifications to the completed task.
A3 words = context.a3.extract_modifications (); A3 words = context.a3.extract_modifications ();
if (!words.size ()) if (!words.size ())
@ -119,8 +118,11 @@ int CmdDenotate::execute (std::string& output)
if (taskDiff (before, *task)) if (taskDiff (before, *task))
{ {
if (permission.confirmed (before, std::string question = format (STRING_CMD_DENO_QUESTION,
taskDifferences (before, *task) + STRING_CMD_DONE_PROCEED)) task->id,
task->get ("description"));
if (permission.confirmed (*task, taskDifferences (before, *task) + question))
{ {
++count; ++count;
context.tdb2.modify (*task); context.tdb2.modify (*task);
@ -131,11 +133,23 @@ int CmdDenotate::execute (std::string& output)
} }
} }
else else
{
out << format (STRING_CMD_DENO_NOMATCH, pattern) out << format (STRING_CMD_DENO_NOMATCH, pattern)
<< "\n"; << "\n";
rc = 1;
}
} }
context.tdb2.commit (); context.tdb2.commit ();
if (context.verbose ("affected") ||
context.config.getBoolean ("echo.command")) // Deprecated 2.0
out << format ((count == 1
? STRING_CMD_DENO_TASK
: STRING_CMD_DENO_TASKS),
count)
<< "\n";
output = out.str (); output = out.str ();
return rc; return rc;
} }