mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdChart: Observes data range when 'report.<type>.hours = auto'
This commit is contained in:
parent
4f18649945
commit
29ac612614
1 changed files with 8 additions and 4 deletions
|
@ -45,7 +45,7 @@ static std::string renderDayName (const std::string&, const Rules&, Date
|
||||||
static std::string renderTotal (const std::string&, const Rules&, time_t);
|
static std::string renderTotal (const std::string&, const Rules&, time_t);
|
||||||
static std::string renderSubTotal (const std::string&, const Rules&, int, int, time_t);
|
static std::string renderSubTotal (const std::string&, const Rules&, int, int, time_t);
|
||||||
static void renderExclusionBlocks (const std::string&, const Rules&, std::vector <Composite>&, Palette&, const Datetime&, int, int, const std::vector <Range>&);
|
static void renderExclusionBlocks (const std::string&, const Rules&, std::vector <Composite>&, Palette&, const Datetime&, int, int, const std::vector <Range>&);
|
||||||
static void renderInterval (const std::string&, const Rules&, std::vector <Composite>&, const Datetime&, const Interval&, Palette&, std::map <std::string, Color>&, time_t&);
|
static void renderInterval (const std::string&, const Rules&, std::vector <Composite>&, const Datetime&, const Interval&, Palette&, std::map <std::string, Color>&, int, time_t&);
|
||||||
std::string renderHolidays (const std::string&, const Rules&, const Interval&);
|
std::string renderHolidays (const std::string&, const Rules&, const Interval&);
|
||||||
static std::string renderSummary (const std::string&, const Rules&, const std::string&, const Interval&, const std::vector <Range>&, const std::vector <Interval>&, bool);
|
static std::string renderSummary (const std::string&, const Rules&, const std::string&, const Interval&, const std::vector <Range>&, const std::vector <Interval>&, bool);
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ int renderChart (
|
||||||
for (auto& track : tracked)
|
for (auto& track : tracked)
|
||||||
{
|
{
|
||||||
time_t interval_work = 0;
|
time_t interval_work = 0;
|
||||||
renderInterval (type, rules, lines, day, track, palette, tag_colors, interval_work);
|
renderInterval (type, rules, lines, day, track, palette, tag_colors, first_hour, interval_work);
|
||||||
work += interval_work;
|
work += interval_work;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,6 +208,8 @@ int renderChart (
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Scan all tracked intervals, looking for the earliest and latest hour into
|
||||||
|
// which an interval extends.
|
||||||
static void determineHourRange (
|
static void determineHourRange (
|
||||||
const std::string& type,
|
const std::string& type,
|
||||||
const Rules& rules,
|
const Rules& rules,
|
||||||
|
@ -217,6 +219,7 @@ static void determineHourRange (
|
||||||
{
|
{
|
||||||
if (rules.get ("reports." + type + ".hours") == "auto")
|
if (rules.get ("reports." + type + ".hours") == "auto")
|
||||||
{
|
{
|
||||||
|
// Default to the full day.
|
||||||
first_hour = 0;
|
first_hour = 0;
|
||||||
last_hour = 23;
|
last_hour = 23;
|
||||||
|
|
||||||
|
@ -443,6 +446,7 @@ static void renderInterval (
|
||||||
const Interval& track,
|
const Interval& track,
|
||||||
Palette& palette,
|
Palette& palette,
|
||||||
std::map <std::string, Color>& tag_colors,
|
std::map <std::string, Color>& tag_colors,
|
||||||
|
int first_hour,
|
||||||
time_t& work)
|
time_t& work)
|
||||||
{
|
{
|
||||||
auto spacing = rules.getInteger ("reports." + type + ".spacing");
|
auto spacing = rules.getInteger ("reports." + type + ".spacing");
|
||||||
|
@ -457,8 +461,8 @@ static void renderInterval (
|
||||||
if (track.range.is_open ())
|
if (track.range.is_open ())
|
||||||
clipped.range.end = Datetime ();
|
clipped.range.end = Datetime ();
|
||||||
|
|
||||||
auto start_mins = clipped.range.start.hour () * 60 + clipped.range.start.minute ();
|
auto start_mins = (clipped.range.start.hour () - first_hour) * 60 + clipped.range.start.minute ();
|
||||||
auto end_mins = clipped.range.end.hour () * 60 + clipped.range.end.minute ();
|
auto end_mins = (clipped.range.end.hour () - first_hour) * 60 + clipped.range.end.minute ();
|
||||||
if (end_mins == 0)
|
if (end_mins == 0)
|
||||||
end_mins = (23 * 60) + 59;
|
end_mins = (23 * 60) + 59;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue