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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user