[mod] reminder logic
This commit is contained in:
parent
29e8daa719
commit
1fe66bc673
|
@ -41,38 +41,45 @@ namespace _munin
|
||||||
.reduce((x, y) => x.concat(y), [])
|
.reduce((x, y) => x.concat(y), [])
|
||||||
);
|
);
|
||||||
for (const target of targets) {
|
for (const target of targets) {
|
||||||
|
const window_from : lib_plankton.pit.type_pit = lib_plankton.pit.shift_hour(
|
||||||
|
now,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
const window_to : lib_plankton.pit.type_pit = lib_plankton.pit.shift_hour(
|
||||||
|
now,
|
||||||
|
conf.settings.interval
|
||||||
|
);
|
||||||
lib_plankton.log._info(
|
lib_plankton.log._info(
|
||||||
"munin.run.iteration",
|
"munin.run.iteration",
|
||||||
{
|
{
|
||||||
"details": {
|
"details": {
|
||||||
"target": target,
|
"target": target.show(),
|
||||||
|
"window_from": lib_plankton.pit.to_date_object(window_from).toISOString(),
|
||||||
|
"window_to": lib_plankton.pit.to_date_object(window_to).toISOString(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
for (const hours of target.reminders) {
|
for (const reminder_hours of target.reminders) {
|
||||||
const window_from : lib_plankton.pit.type_pit = lib_plankton.pit.shift_hour(
|
|
||||||
now,
|
|
||||||
hours + 0
|
|
||||||
);
|
|
||||||
const window_to : lib_plankton.pit.type_pit = lib_plankton.pit.shift_hour(
|
|
||||||
now,
|
|
||||||
hours + conf.settings.interval
|
|
||||||
);
|
|
||||||
for (const event of events) {
|
for (const event of events) {
|
||||||
const event_begin : lib_plankton.pit.type_pit = lib_plankton.pit.from_datetime(event.begin);
|
const event_begin : lib_plankton.pit.type_pit = lib_plankton.pit.from_datetime(
|
||||||
lib_plankton.log._debug(
|
event.begin
|
||||||
|
);
|
||||||
|
const reminder_time : lib_plankton.pit.type_pit = lib_plankton.pit.shift_hour(
|
||||||
|
event_begin,
|
||||||
|
(-reminder_hours)
|
||||||
|
);
|
||||||
|
lib_plankton.log._info(
|
||||||
"munin.run.check_dueness",
|
"munin.run.check_dueness",
|
||||||
{
|
{
|
||||||
"details": {
|
"details": {
|
||||||
// "now": lib_plankton.pit.to_date_object(now).toISOString(),
|
|
||||||
"event_begin": lib_plankton.pit.to_date_object(event_begin).toISOString(),
|
"event_begin": lib_plankton.pit.to_date_object(event_begin).toISOString(),
|
||||||
"window_from": lib_plankton.pit.to_date_object(window_from).toISOString(),
|
"reminder_hours": reminder_hours,
|
||||||
"window_to": lib_plankton.pit.to_date_object(window_to).toISOString(),
|
"reminder_time": lib_plankton.pit.to_date_object(reminder_time).toISOString(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const remind : boolean = lib_plankton.pit.is_between(
|
const remind : boolean = lib_plankton.pit.is_between(
|
||||||
event_begin,
|
reminder_time,
|
||||||
window_from,
|
window_from,
|
||||||
window_to
|
window_to
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue