Allow deleting templates
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user