mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug #605
+ Fixed bug #605, which gave misleading project completion percentages under certain circumstances (thanks to Steve Rader).
This commit is contained in:
parent
5f8b3cf989
commit
86ef048cb0
2 changed files with 13 additions and 1 deletions
|
@ -2194,8 +2194,18 @@ std::string onProjectChange (Task& task, bool scope /* = true */)
|
|||
countTasks (all, project, context.tdb.getAllModified (), count_pending, count_done);
|
||||
countTasks (context.tdb.getAllModified (), project, (std::vector <Task>) NULL, count_pending, count_done);
|
||||
|
||||
// count_done count_pending percentage
|
||||
// ---------- ------------- ----------
|
||||
// 0 0 0%
|
||||
// >0 0 100%
|
||||
// 0 >0 0%
|
||||
// >0 >0 calculated
|
||||
int percentage = 0;
|
||||
if (count_done + count_pending > 0)
|
||||
if (count_done == 0)
|
||||
percentage = 0;
|
||||
else if (count_pending == 0)
|
||||
percentage = 100;
|
||||
else
|
||||
percentage = (count_done * 100 / (count_done + count_pending));
|
||||
|
||||
msg << "Project '"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue