Skip to content

Commit 90627ce

Browse files
committed
Readjust range in case of :all hint
The all hint specifies an empty range which results in no intervals rendered if processed. Readjust the range to the range defined by the given intervals in this case. Closes #728 Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
1 parent 03d2c99 commit 90627ce

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
- #727 :color hint does not work with the summary report
22
(thanks to Alex Rogers)
3+
- #728 :all hint does not work in chart reports
4+
(thanks to Alex Rogers)
35

46
------ current release ---------------------------
57

src/Chart.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,17 @@ std::string Chart::render (
9797
// Each day is rendered separately.
9898
time_t total_work = 0;
9999

100-
for (Datetime day = range.start; day < range.end; day++)
100+
auto range_start = range.is_started () ? range.start : tracked.front ().start;
101+
auto range_end = range.is_ended () ? range.end : tracked.back ().end;
102+
103+
const auto now = Datetime ();
104+
105+
if (range_end == 0)
106+
{
107+
range_end = now;
108+
}
109+
110+
for (Datetime day = range_start.startOfDay (); day < range_end; ++day)
101111
{
102112
// Render the exclusion blocks.
103113

@@ -154,7 +164,7 @@ std::string Chart::render (
154164

155165
out << (with_totals ? renderSubTotal (total_work, std::string (padding_size, ' ')) : "")
156166
<< (with_holidays ? renderHolidays (holidays) : "")
157-
<< (with_summary ? renderSummary (indent, range, exclusions, tracked) : "");
167+
<< (with_summary ? renderSummary (indent, {range_start, range_end}, exclusions, tracked) : "");
158168

159169
return out.str ();
160170
}

0 commit comments

Comments
 (0)