Add configurable default range for report 'gaps'

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2023-04-02 18:06:55 +02:00
parent c6130157c6
commit fd1e26eff3
2 changed files with 7 additions and 12 deletions

View file

@ -90,9 +90,6 @@ Rules::Rules ()
// 'summary' report.
{"reports.summary.holidays", "yes"},
// 'gaps' report.
{"reports.gaps.range", ":day"},
// Enough of a theme to make the charts work.
{"theme.description", "Built-in default"},
{"theme.colors.exclusion", "gray8 on gray4"},

View file

@ -39,15 +39,13 @@ int CmdGaps (
{
const bool verbose = rules.getBoolean ("verbose");
// If filter is empty, choose 'today'.
auto filter = cli.getFilter ();
if (! filter.is_started ())
{
if (rules.has ("reports.gaps.range"))
expandIntervalHint (rules.get ("reports.gaps.range"), filter);
else
filter.setRange (Datetime ("today"), Datetime ("tomorrow"));
}
auto default_hint = rules.get ("reports.range", "day");
auto report_hint = rules.get ("reports.gaps.range", default_hint);
Range default_range = {};
expandIntervalHint (":" + report_hint, default_range);
auto filter = cli.getFilter (default_range);
// Is the :blank hint being used?
bool blank = cli.getHint ("blank", false);