From 6af7540fe759e983917ab70079789d38c3a439ab Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 7 Oct 2010 23:40:03 -0400 Subject: [PATCH] Bug - Fixed a divide-by-zero bug in the project completion calculations, that was uncovered by sync testing. --- src/report.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/report.cpp b/src/report.cpp index 943e7630a..64ce5725a 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -2874,10 +2874,14 @@ std::string onProjectChange (Task& task, bool scope /* = true */) countTasks (context.tdb.getAllNew (), project, "nope", count_pending, count_done); countTasks (context.tdb.getAllModified (), project, "nope", count_pending, count_done); + int percentage = 0; + if (count_done + count_pending > 0) + percentage = (count_done * 100 / (count_done + count_pending)); + msg << "Project '" << project << "' is " - << (count_done * 100 / (count_done + count_pending)) + << percentage << "% complete (" << count_pending << " of "