From 16356a3270dc7d0eec8b059fdd2c18382fe16628 Mon Sep 17 00:00:00 2001 From: Thomas Lauf Date: Sat, 29 Dec 2018 11:11:24 +0100 Subject: [PATCH] Partially extract rules from renderInterval --- src/commands/CmdChart.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/commands/CmdChart.cpp b/src/commands/CmdChart.cpp index fe28f44f..10ef4f4f 100644 --- a/src/commands/CmdChart.cpp +++ b/src/commands/CmdChart.cpp @@ -45,7 +45,7 @@ static std::string renderDay (Datetime&, const std::vector&, bool, const Datetime&, int, int, const std::vector &); -static void renderInterval (const std::string&, const Rules&, std::vector &, const Datetime&, const Interval&, std::map &, int, time_t&, bool); +static void renderInterval (const Rules&, std::vector&, const Datetime&, const Interval&, std::map&, int, time_t&, bool, int, int); std::string renderHolidays (const Rules&, const Interval&, const std::vector&); static std::string renderSummary (const std::string&, const Interval&, const std::vector &, const std::vector &, bool); @@ -215,7 +215,7 @@ int renderChart ( for (auto& track : tracked) { time_t interval_work = 0; - renderInterval (type, rules, lines, day, track, tag_colors, first_hour, interval_work, ids); + renderInterval (rules, lines, day, track, tag_colors, first_hour, interval_work, ids, minutes_per_char, spacing); work += interval_work; } } @@ -549,7 +549,6 @@ static void renderExclusionBlocks ( //////////////////////////////////////////////////////////////////////////////// static void renderInterval ( - const std::string& type, const Rules& rules, std::vector & lines, const Datetime& day, @@ -557,13 +556,11 @@ static void renderInterval ( std::map & tag_colors, int first_hour, time_t& work, - bool ids) + bool ids, + const int minutes_per_char, + const int spacing) { Datetime now; - auto minutes_per_char = rules.getInteger ("reports." + type + ".cell"); - if (minutes_per_char < 1) - throw format ("The value for 'reports.{1}.cell' must be at least 1.", type); - auto spacing = rules.getInteger ("reports." + type + ".spacing"); // Ignore any track that doesn't overlap with day. auto day_range = getFullDay (day);