mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-10 04:00:37 +02:00
CmdModify: Code cleanup
This commit is contained in:
parent
63bbe857c8
commit
1187ad16cc
1 changed files with 6 additions and 9 deletions
|
@ -56,7 +56,6 @@ CmdModify::CmdModify ()
|
||||||
int CmdModify::execute (std::string&)
|
int CmdModify::execute (std::string&)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
// Apply filter.
|
// Apply filter.
|
||||||
Filter filter;
|
Filter filter;
|
||||||
|
@ -71,6 +70,7 @@ int CmdModify::execute (std::string&)
|
||||||
// Accumulated project change notifications.
|
// Accumulated project change notifications.
|
||||||
std::map <std::string, std::string> projectChanges;
|
std::map <std::string, std::string> projectChanges;
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
for (auto& task : filtered)
|
for (auto& task : filtered)
|
||||||
{
|
{
|
||||||
Task before (task);
|
Task before (task);
|
||||||
|
@ -135,26 +135,23 @@ int CmdModify::modifyAndUpdate (
|
||||||
Task &before, Task &after,
|
Task &before, Task &after,
|
||||||
std::map <std::string, std::string> *projectChanges /* = NULL */)
|
std::map <std::string, std::string> *projectChanges /* = NULL */)
|
||||||
{
|
{
|
||||||
int count = 0;
|
// This task.
|
||||||
|
int count = 1;
|
||||||
|
|
||||||
updateRecurrenceMask (after);
|
updateRecurrenceMask (after);
|
||||||
++count;
|
|
||||||
feedback_affected (STRING_CMD_MODIFY_TASK, after);
|
feedback_affected (STRING_CMD_MODIFY_TASK, after);
|
||||||
feedback_unblocked (after);
|
feedback_unblocked (after);
|
||||||
context.tdb2.modify (after);
|
context.tdb2.modify (after);
|
||||||
if (context.verbose ("project") && projectChanges)
|
if (context.verbose ("project") && projectChanges)
|
||||||
(*projectChanges)[after.get ("project")] = onProjectChange (before, after);
|
(*projectChanges)[after.get ("project")] = onProjectChange (before, after);
|
||||||
|
|
||||||
if (after.has ("parent"))
|
|
||||||
{
|
|
||||||
// Task has siblings - modify them.
|
// Task has siblings - modify them.
|
||||||
|
if (after.has ("parent"))
|
||||||
count += modifyRecurrenceSiblings (after, projectChanges);
|
count += modifyRecurrenceSiblings (after, projectChanges);
|
||||||
}
|
|
||||||
else if (after.get ("status") == "recurring")
|
|
||||||
{
|
|
||||||
// Task has child tasks - modify them.
|
// Task has child tasks - modify them.
|
||||||
|
else if (after.get ("status") == "recurring")
|
||||||
count += modifyRecurrenceParent (after, projectChanges);
|
count += modifyRecurrenceParent (after, projectChanges);
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue