From 1187ad16cc2f924f34d3b64fa05a69c1b6040d5a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 2 Feb 2016 01:04:40 -0500 Subject: [PATCH] CmdModify: Code cleanup --- src/commands/CmdModify.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/commands/CmdModify.cpp b/src/commands/CmdModify.cpp index 0f795bd45..d2a71d3ff 100644 --- a/src/commands/CmdModify.cpp +++ b/src/commands/CmdModify.cpp @@ -56,7 +56,6 @@ CmdModify::CmdModify () int CmdModify::execute (std::string&) { int rc = 0; - int count = 0; // Apply filter. Filter filter; @@ -71,6 +70,7 @@ int CmdModify::execute (std::string&) // Accumulated project change notifications. std::map projectChanges; + int count = 0; for (auto& task : filtered) { Task before (task); @@ -135,26 +135,23 @@ int CmdModify::modifyAndUpdate ( Task &before, Task &after, std::map *projectChanges /* = NULL */) { - int count = 0; + // This task. + int count = 1; updateRecurrenceMask (after); - ++count; feedback_affected (STRING_CMD_MODIFY_TASK, after); feedback_unblocked (after); context.tdb2.modify (after); if (context.verbose ("project") && projectChanges) (*projectChanges)[after.get ("project")] = onProjectChange (before, after); + // Task has siblings - modify them. if (after.has ("parent")) - { - // Task has siblings - modify them. count += modifyRecurrenceSiblings (after, projectChanges); - } + + // Task has child tasks - modify them. else if (after.get ("status") == "recurring") - { - // Task has child tasks - modify them. count += modifyRecurrenceParent (after, projectChanges); - } return count; }