From c27097e286db9810ed8c4e657093ca18be9422a7 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 28 Aug 2010 09:37:32 -0400 Subject: [PATCH] Bug - Fixed a precision problem with average age on the summary report. The problem was that average age is calculated as the sum of all ages, divided by the count. The sum was already being stored as a double, to allow for very high values, but was being truncated to an int before being divided by the count. Classic precision mishandling. --- ChangeLog | 1 + src/report.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7f9790117..e28900cbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -67,6 +67,7 @@ + Fixed problem with the 'undo' command not observing the rc.color or the rc._forcecolor settings. + Fixed problem with extra blank line in the ghistory reports. + + Fixed a precision problem with average age on the summary report. + Clarified the documentation regarding the project name (taskwarrior) and the program name (task). diff --git a/src/report.cpp b/src/report.cpp index 0aa07265d..45be77a21 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -759,7 +759,7 @@ int handleReportSummary (std::string &outs) table.addCell (row, 0, (i->first == "" ? "(none)" : i->first)); table.addCell (row, 1, countPending[i->first]); if (counter[i->first]) - table.addCell (row, 2, Duration ((int) sumEntry[i->first] / counter[i->first]).format ()); + table.addCell (row, 2, Duration ((int) (sumEntry[i->first] / (double)counter[i->first])).format ()); int c = countCompleted[i->first]; int p = countPending[i->first];