feat: show missed tasks
This commit is contained in:
@@ -41,7 +41,7 @@ export function parseCron(cron: string | null): {
|
||||
type: CronType.EVERY_MONTH,
|
||||
value: 32,
|
||||
};
|
||||
} else if ((value = /^0 0 \* \* (\d+)\#1$/i.exec(cron)) !== null) {
|
||||
} else if ((value = /^0 0 \* \* (\d+)#1$/i.exec(cron)) !== null) {
|
||||
return {
|
||||
type: CronType.EVERY_MONTH,
|
||||
value: -parseInt(value[1] ?? ""),
|
||||
@@ -49,7 +49,7 @@ export function parseCron(cron: string | null): {
|
||||
} else if ((value = /^0 0 \* \* (\d+)L$/i.exec(cron)) !== null) {
|
||||
return {
|
||||
type: CronType.EVERY_MONTH,
|
||||
value: -parseInt(value[1] ?? "")-7,
|
||||
value: -parseInt(value[1] ?? "") - 7,
|
||||
};
|
||||
} else if ((value = /^0 0 1 (\d+) \*$/i.exec(cron)) !== null) {
|
||||
return {
|
||||
@@ -121,7 +121,7 @@ export function getCron(
|
||||
return `0 0 * * ${(-value).toFixed(0)}#1`;
|
||||
}
|
||||
if (value < -7 && value >= -14) {
|
||||
return `0 0 * * ${(-value-7).toFixed(0)}L`;
|
||||
return `0 0 * * ${(-value - 7).toFixed(0)}L`;
|
||||
}
|
||||
return `0 0 ${value.toFixed(0)} * *`;
|
||||
case CronType.EVERY_YEAR:
|
||||
|
||||
@@ -38,6 +38,10 @@ export function taskNextReset(task: Task): Date | null {
|
||||
return nextCronReset(task.check_date, task.reset_cron, task.id);
|
||||
}
|
||||
|
||||
export function taskFutureReset(task: Task): Date | null {
|
||||
return nextCronReset(taskNextReset(task), task.reset_cron, task.id);
|
||||
}
|
||||
|
||||
export function taskCompleted(task: Task): boolean {
|
||||
const nextReset = taskNextReset(task);
|
||||
if (nextReset === null) {
|
||||
|
||||
Reference in New Issue
Block a user