mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-25 03:07:20 +02:00
Logic Bug
- Fixed logic bug with bulk and recurring task annotations.
This commit is contained in:
parent
4d7d0f04f3
commit
f4cd733311
1 changed files with 56 additions and 15 deletions
|
@ -25,7 +25,6 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#define L10N // Localization complete.
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -33,6 +32,7 @@
|
||||||
#include <Permission.h>
|
#include <Permission.h>
|
||||||
#include <main.h>
|
#include <main.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
|
#include <util.h>
|
||||||
#include <i18n.h>
|
#include <i18n.h>
|
||||||
#include <CmdAnnotate.h>
|
#include <CmdAnnotate.h>
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ int CmdAnnotate::execute (std::string& output)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the command line modifications to the completed task.
|
// Apply the command line modifications to the new task.
|
||||||
A3 modifications = context.a3.extract_modifications ();
|
A3 modifications = context.a3.extract_modifications ();
|
||||||
if (!modifications.size ())
|
if (!modifications.size ())
|
||||||
throw std::string (STRING_CMD_XPEND_NEED_TEXT);
|
throw std::string (STRING_CMD_XPEND_NEED_TEXT);
|
||||||
|
@ -77,25 +77,66 @@ int CmdAnnotate::execute (std::string& output)
|
||||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||||
{
|
{
|
||||||
Task before (*task);
|
Task before (*task);
|
||||||
|
|
||||||
|
// Annotate the specified task.
|
||||||
|
std::string question = format (STRING_CMD_ANNO_QUESTION,
|
||||||
|
task->id,
|
||||||
|
task->get ("description"));
|
||||||
|
|
||||||
modify_task_annotate (*task, modifications);
|
modify_task_annotate (*task, modifications);
|
||||||
|
|
||||||
if (taskDiff (before, *task))
|
if (permission.confirmed (*task, taskDifferences (before, *task) + question))
|
||||||
{
|
{
|
||||||
if (permission.confirmed (before,
|
context.tdb2.modify (*task);
|
||||||
taskDifferences (before, *task)
|
++count;
|
||||||
+ STRING_CMD_DONE_PROCEED))
|
|
||||||
{
|
|
||||||
context.tdb2.modify (*task);
|
|
||||||
++count;
|
|
||||||
|
|
||||||
if (context.verbose ("affected") ||
|
if (context.verbose ("affected") ||
|
||||||
context.config.getBoolean ("echo.command")) // Deprecated 2.0
|
context.config.getBoolean ("echo.command")) // Deprecated 2.0
|
||||||
out << format (STRING_CMD_ANNO_DONE,
|
out << format (task->has ("parent")
|
||||||
task->id,
|
? STRING_CMD_ANNO_RECURRING
|
||||||
task->get ("description"))
|
: STRING_CMD_ANNO_DELETING,
|
||||||
<< "\n";
|
task->id,
|
||||||
|
task->get ("description"))
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
|
dependencyChainOnComplete (*task);
|
||||||
|
context.footnote (onProjectChange (*task, true));
|
||||||
|
|
||||||
|
// Annotate siblings.
|
||||||
|
if (task->has ("parent"))
|
||||||
|
{
|
||||||
|
std::vector <Task> siblings = context.tdb2.siblings (*task);
|
||||||
|
if (siblings.size () &&
|
||||||
|
confirm (STRING_CMD_ANNO_CONF_RECUR))
|
||||||
|
{
|
||||||
|
std::vector <Task>::iterator sibling;
|
||||||
|
for (sibling = siblings.begin (); sibling != siblings.end (); ++sibling)
|
||||||
|
{
|
||||||
|
modify_task_annotate (*sibling, modifications);
|
||||||
|
context.tdb2.modify (*sibling);
|
||||||
|
++count;
|
||||||
|
|
||||||
|
if (context.verbose ("affected") ||
|
||||||
|
context.config.getBoolean ("echo.command")) // Deprecated 2.0
|
||||||
|
out << format (STRING_CMD_ANNO_RECURRING,
|
||||||
|
sibling->id,
|
||||||
|
sibling->get ("description"))
|
||||||
|
<< "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Annotate the parent
|
||||||
|
Task parent;
|
||||||
|
context.tdb2.get (task->get ("parent"), parent);
|
||||||
|
modify_task_annotate (parent, modifications);
|
||||||
|
context.tdb2.modify (parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
out << STRING_CMD_DELETE_NOT << "\n";
|
||||||
|
rc = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.tdb2.commit ();
|
context.tdb2.commit ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue