Allow deleting templates

This commit is contained in:
2025-05-11 15:40:12 +02:00
parent 058291fa80
commit 384aa4eb6f
10 changed files with 194 additions and 125 deletions

View File

@@ -15,4 +15,18 @@ class RecurringTransaction {
final template = IsarLink<TransactionTemplate>();
final account = IsarLink<Account>();
bool isDue(DateTime now) {
if (lastExecution == null) {
return true;
}
final expectedNextExecution = lastExecution!.add(Duration(days: days));
if (now.isAfter(expectedNextExecution)) {
return true;
}
return now.difference(expectedNextExecution).inDays.abs() <=
(days * 0.5).toInt();
}
}