mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
feedback: Consider start and end attributes when reporting task durations
Instead of relying on the modification times, we can use the values of the start and end attributes, if available. This allows us to perform historical changes that result in correct duration intervals reported by task info. Closes #2514
This commit is contained in:
parent
a519cf59f2
commit
cc0ba46873
1 changed files with 11 additions and 1 deletions
|
@ -171,9 +171,19 @@ std::string taskInfoDifferences (
|
|||
}
|
||||
else if (name == "start")
|
||||
{
|
||||
Datetime started (before.get ("start"));
|
||||
Datetime stopped;
|
||||
|
||||
if (after.has ("end"))
|
||||
// Task was marked as finished, use end time
|
||||
stopped = Datetime (after.get ("end"));
|
||||
else
|
||||
// Start attribute was removed, use modification time
|
||||
stopped = Datetime (current_timestamp);
|
||||
|
||||
out << format ("{1} deleted (duration: {2}).",
|
||||
Lexer::ucFirst (name),
|
||||
Duration (current_timestamp - last_timestamp).format ())
|
||||
Duration (stopped - started).format ())
|
||||
<< "\n";
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue