mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Extract rules from renderMonth
This commit is contained in:
parent
1d3a19fd3f
commit
7f7f2cb84a
1 changed files with 7 additions and 12 deletions
|
@ -38,7 +38,7 @@
|
|||
int renderChart (const CLI&, const std::string&, Interval&, Rules&, Database&);
|
||||
static std::pair<int, int> determineHourRange (const std::string&, const Rules&, const Interval&, const std::vector <Interval>&);
|
||||
static void renderAxis (const std::string&, const Rules&, bool, const std::string&, int, int);
|
||||
static std::string renderMonth (const std::string&, const Rules&, const Datetime&, const Datetime&);
|
||||
static std::string renderMonth (const Datetime &previous, const Datetime &day);
|
||||
static std::string renderWeek (const std::string&, const Rules&, const Datetime&, const Datetime&);
|
||||
static std::string renderDayName (const std::string&, const Rules&, Datetime&, Color&, Color&);
|
||||
static std::string renderTotal (const std::string&, const Rules&, time_t);
|
||||
|
@ -196,7 +196,9 @@ int renderChart (
|
|||
}
|
||||
}
|
||||
|
||||
auto labelMonth = renderMonth (type, rules, previous, day);
|
||||
const auto with_month = rules.getBoolean ("reports." + type + ".month");
|
||||
|
||||
auto labelMonth = with_month ? renderMonth (previous, day) : "";
|
||||
auto labelWeek = renderWeek (type, rules, previous, day);
|
||||
auto labelDay = renderDayName (type, rules, day, colorToday, colorHoliday);
|
||||
|
||||
|
@ -345,19 +347,12 @@ static void renderAxis (
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static std::string renderMonth (
|
||||
const std::string &type,
|
||||
const Rules &rules,
|
||||
const Datetime &previous,
|
||||
const Datetime &day)
|
||||
static std::string renderMonth (const Datetime &previous, const Datetime &day)
|
||||
{
|
||||
auto with_month = rules.getBoolean ("reports." + type + ".month");
|
||||
|
||||
const auto show_month = previous.month () != day.month ();
|
||||
|
||||
std::stringstream out;
|
||||
|
||||
if (with_month)
|
||||
out << (show_month ? Datetime::monthNameShort (day.month ()) : " ")
|
||||
<< ' ';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue