Nag based on task state before modification
With this patch, taskwarrior uses the urgency of tasks before any modifications are applied when deciding whether to show nag messages. Previously, taskwarrior would apply modifications before deciding whether to show nag messages, which could lead to spurious nag messages when completing an active task.
This commit is contained in:
@@ -68,10 +68,11 @@ int CmdStart::execute (std::string&)
|
||||
// Accumulated project change notifications.
|
||||
std::map <std::string, std::string> projectChanges;
|
||||
|
||||
bool nagged = false;
|
||||
if(filtered.size() > 1) {
|
||||
feedback_affected("This command will alter {1} tasks.", filtered.size());
|
||||
}
|
||||
|
||||
std::vector <Task> modified;
|
||||
for (auto& task : filtered)
|
||||
{
|
||||
if (! task.has ("start"))
|
||||
@@ -101,11 +102,12 @@ int CmdStart::execute (std::string&)
|
||||
Context::getContext ().tdb2.modify (task);
|
||||
++count;
|
||||
feedback_affected ("Starting task {1} '{2}'.", task);
|
||||
if (!nagged)
|
||||
nagged = nag (task);
|
||||
dependencyChainOnStart (task);
|
||||
if (Context::getContext ().verbose ("project"))
|
||||
projectChanges[task.get ("project")] = onProjectChange (task, false);
|
||||
|
||||
// Save unmodified task for potential nagging later
|
||||
modified.push_back(before);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -125,6 +127,8 @@ int CmdStart::execute (std::string&)
|
||||
}
|
||||
}
|
||||
|
||||
nag (modified);
|
||||
|
||||
// Now list the project changes.
|
||||
for (auto& change : projectChanges)
|
||||
if (change.first != "")
|
||||
|
||||
Reference in New Issue
Block a user