mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
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:
parent
607baa081d
commit
b33a99a748
5 changed files with 98 additions and 33 deletions
|
@ -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 != "")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue