From e2573d4516c51462d027579f9ac9ef70c255aad5 Mon Sep 17 00:00:00 2001 From: Janik Rabe Date: Wed, 8 Aug 2018 16:43:37 +0300 Subject: [PATCH] TW #2007: Compute number of current tasks correctly Closes #2007 --- src/commands/CmdBurndown.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/commands/CmdBurndown.cpp b/src/commands/CmdBurndown.cpp index b3c2e3110..f6aa6e642 100644 --- a/src/commands/CmdBurndown.cpp +++ b/src/commands/CmdBurndown.cpp @@ -195,6 +195,8 @@ Chart::~Chart () void Chart::scanForPeak (std::vector & tasks) { std::map pending; + _current_count = 0; + for (auto& task : tasks) { // The entry date is when the counting starts. @@ -203,6 +205,8 @@ void Chart::scanForPeak (std::vector & tasks) Datetime end; if (task.has ("end")) end = Datetime (task.get_date ("end")); + else + ++_current_count; while (entry < end) { @@ -216,7 +220,7 @@ void Chart::scanForPeak (std::vector & tasks) } } - // Find the peak, peak date and current. + // Find the peak and peak date. for (auto& count : pending) { if (count.second > _peak_count) @@ -224,8 +228,6 @@ void Chart::scanForPeak (std::vector & tasks) _peak_count = count.second; _peak_epoch = count.first; } - - _current_count = count.second; } }