mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdReportDay: Determines hors to be shown
This commit is contained in:
parent
6d628a38d8
commit
662077dc1a
1 changed files with 22 additions and 4 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <Range.h>
|
||||
#include <commands.h>
|
||||
#include <timew.h>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -59,11 +60,28 @@ int CmdReportDay (
|
|||
// Map tags to colors.
|
||||
auto tag_colors = createTagColorMap (rules, palette, tracked);
|
||||
|
||||
// TODO Get the exclusion ranges, to render the exclused time.
|
||||
// TODO Get the earliest hour of the filtered data.
|
||||
// TODO Get the latest hour of the filtered data.
|
||||
// Determine hours shown.
|
||||
int first_hour = 0;
|
||||
int last_hour = 23;
|
||||
if (! rules.getBoolean ("report.day.24hours"))
|
||||
{
|
||||
// Get the extreme time range for the filtered data.
|
||||
first_hour = 23;
|
||||
last_hour = 0;
|
||||
for (auto& track : tracked)
|
||||
{
|
||||
if (track.range.start.hour () < first_hour)
|
||||
first_hour = track.range.start.hour ();
|
||||
|
||||
// TODO Axis, hard-coded.
|
||||
if (track.range.end.hour () > last_hour)
|
||||
last_hour = track.range.end.hour ();
|
||||
}
|
||||
|
||||
first_hour = std::max (first_hour - 1, 0);
|
||||
last_hour = std::min (last_hour + 1, 23);
|
||||
}
|
||||
|
||||
// Render the axis.
|
||||
std::string indent = " ";
|
||||
std::cout << '\n'
|
||||
<< indent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue