fix: Properly saving tasks

Tasks were not properly saved by the JsonTaskList, resulting in the newly created tasks being discarded immediately. Fixed by putting them into the taskMap in saveTask()
This commit is contained in:
David Guler 2022-11-21 09:15:29 +01:00
parent bfe3fcfb79
commit ffc7f5174e
3 changed files with 40 additions and 41 deletions

View File

@ -106,6 +106,7 @@ public class JsonTaskList implements TaskList {
if(task.getId() == 0) { if(task.getId() == 0) {
task.withId(idProvider.incrementAndGet()); task.withId(idProvider.incrementAndGet());
} }
taskMap.put(task.getId(), task);
writeTaskListToFile(); writeTaskListToFile();
} }

View File

@ -184,15 +184,14 @@
"litersPerSqM": 15, "litersPerSqM": 15,
"interval": 4, "interval": 4,
"notes": [ "notes": [
] ]
}, },
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "Plant Sets",
"relativeStartDate": 0, "relativeStartDate": 0,
"relativeEndDate": 0, "relativeEndDate": 0,
"description": "Mound up the soil around the plant until just the top few leaves show above the soil. ", "description": "Plant the sets about 5cm deep into the soil.",
"interval": null, "interval": null,
"isOptional": false "isOptional": false
} }
@ -232,7 +231,6 @@
"litersPerSqM": 0, "litersPerSqM": 0,
"interval": null, "interval": null,
"notes": [ "notes": [
] ]
}, },
"taskTemplates": [ "taskTemplates": [