mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
validate: Generalized code to allow autoFill calls from other places
This commit is contained in:
parent
45b09986d8
commit
1555847537
1 changed files with 26 additions and 30 deletions
|
@ -38,13 +38,10 @@
|
|||
// range.
|
||||
//
|
||||
static void autoFill (
|
||||
const CLI& cli,
|
||||
const Rules& rules,
|
||||
Database& database,
|
||||
const Interval& filter,
|
||||
Interval& interval)
|
||||
{
|
||||
if (findHint (cli, ":fill"))
|
||||
{
|
||||
// An empty filter allows scanning beyond interval.range.
|
||||
Interval range_filter;
|
||||
|
@ -76,7 +73,6 @@ static void autoFill (
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// :adjust
|
||||
|
@ -86,13 +82,12 @@ static void autoFill (
|
|||
// recorded data.
|
||||
//
|
||||
static void autoAdjust (
|
||||
const CLI& cli,
|
||||
bool adjust,
|
||||
const Rules& rules,
|
||||
Database& database,
|
||||
Interval& interval)
|
||||
{
|
||||
// Without :adjust, overlapping intervals are an error condition.
|
||||
auto adjust = findHint (cli, ":adjust");
|
||||
// Without (adjust == true), overlapping intervals are an error condition.
|
||||
|
||||
// An empty filter allows scanning beyond interval.range.
|
||||
Interval range_filter;
|
||||
|
@ -150,7 +145,6 @@ static void autoAdjust (
|
|||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -194,8 +188,10 @@ void validate (
|
|||
filter.range = Range (Datetime ("today"), Datetime ("tomorrow"));
|
||||
|
||||
// All validation performed here.
|
||||
autoFill (cli, rules, database, filter, interval);
|
||||
autoAdjust (cli, rules, database, interval);
|
||||
if (findHint (cli, ":fill"))
|
||||
autoFill (rules, database, filter, interval);
|
||||
|
||||
autoAdjust (findHint (cli, ":adjust"), rules, database, interval);
|
||||
|
||||
// TODO This warning is not working properly, because when an interval is
|
||||
// modified, it ifirst deleted, then added. This causes this code to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue