Skip to content
Permalink
Browse files

Use internal fields color_today and color_holiday in getDayColor

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
  • Loading branch information...
lauft committed Mar 15, 2019
1 parent 9fcadae commit b4a15b3c84c3d3f57b897981915cef758cb90a80
Showing with 6 additions and 8 deletions.
  1. +5 −7 src/Chart.cpp
  2. +1 −1 src/Chart.h
@@ -131,7 +131,7 @@ std::string Chart::render (
}

auto now = Datetime ();
auto color_day = getDayColor (day, now, holidays, color_today, color_holiday);
auto color_day = getDayColor (day, now, holidays);

auto labelMonth = with_label_month ? renderMonth (previous, day) : "";
auto labelWeek = with_label_week ? renderWeek (previous, day) : "";
@@ -326,24 +326,22 @@ std::string Chart::renderDay (Datetime &day, const Color &color)
Color Chart::getDayColor (
const Datetime &day,
const Datetime &now,
const std::map<Datetime, std::string> &holidays,
const Color &colorToday,
const Color &colorHoliday)
const std::map <Datetime, std::string> &holidays)
{
if (day.sameDay (now))
{
return colorToday;
return color_today;
}

for (auto &entry : holidays)
{
if (day.sameDay (entry.first))
{
return colorHoliday;
return color_holiday;
}
}

return Color{};
return Color {};
}

////////////////////////////////////////////////////////////////////////////////
@@ -57,7 +57,7 @@ class Chart

std::pair <int, int> determineHourRange (const Interval&, const std::vector <Interval>&);

Color getDayColor (const Datetime&, const Datetime&, const std::map <Datetime, std::string>&, const Color&, const Color&);
Color getDayColor (const Datetime &, const Datetime &, const std::map<Datetime, std::string> &);

const bool with_label_month;
const bool with_label_week;

0 comments on commit b4a15b3

Please sign in to comment.
You can’t perform that action at this time.