added 'completeNow' methods to recipeStep and recipeSubStep

This commit is contained in:
broodjeaap89 2021-08-24 20:22:18 +02:00
parent 7207686bbc
commit dfd619a9b7
2 changed files with 12 additions and 0 deletions

View file

@ -49,6 +49,14 @@ class RecipeStep extends HiveObject {
completedOn != null;
}
void completeStepNow(){
if (subSteps.isNotEmpty){
subSteps.forEach((subStep) { subStep.completeNow(); });
} else {
completedOn = DateTime.now();
}
}
int convertToSeconds(int value){
switch (waitUnit){
case "minutes": {

View file

@ -18,5 +18,9 @@ class RecipeSubStep extends HiveObject {
bool get completed => completedOn != null;
void completeNow(){
completedOn = DateTime.now();
}
RecipeSubStep(this.name, this.description);
}