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) {
task.withId(idProvider.incrementAndGet());
}
taskMap.put(task.getId(), task);
writeTaskListToFile();
}

View File

@ -184,15 +184,14 @@
"litersPerSqM": 15,
"interval": 4,
"notes": [
]
},
"taskTemplates": [
{
"name": "hilling",
"name": "Plant Sets",
"relativeStartDate": 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,
"isOptional": false
}
@ -232,7 +231,6 @@
"litersPerSqM": 0,
"interval": null,
"notes": [
]
},
"taskTemplates": [

View File

@ -1,56 +1,56 @@
[
{
"id" : 1,
"name" : "sow plant",
"description": "Plant the seeds, crops in de bed.",
"startDate" : "2022-05-01",
"endDate" : "2022-05-01",
"interval" : 0,
"cropId" : 0
"id": 1,
"name": "sow plant",
"description": "Plant the seeds, crops in de bed.",
"startDate": "2022-05-01",
"endDate": "2022-05-01",
"interval": 0,
"cropId": 0
},
{
"id" : 2,
"name" : "water plant",
"id": 2,
"name": "water plant",
"description": "water the plant, so that the soil is wet around the plant.",
"startDate" : "2022-05-01",
"endDate" : "2022-09-01",
"interval" : 2,
"cropId" : 0
"startDate": "2022-05-01",
"endDate": "2022-09-01",
"interval": 2,
"cropId": 0
},
{
"id" : 3,
"name" : "fertilize plant",
"id": 3,
"name": "fertilize plant",
"description": "The fertilizer has to be mixed with water. Then fertilize the plants soil with the mixture",
"startDate" : "2022-06-01",
"endDate" : "2022-08-01",
"interval" : 28,
"cropId" : 0
"startDate": "2022-06-01",
"endDate": "2022-08-01",
"interval": 28,
"cropId": 0
},
{
"id" : 4,
"name" : "covering plant",
"id": 4,
"name": "covering plant",
"description": "Take a big enough coverage for the plants. Cover the whole plant with a bit space between the plant and the coverage",
"startDate" : "2022-07-01",
"endDate" : "2022-07-01",
"interval" : 0,
"cropId" : 0
"startDate": "2022-07-01",
"endDate": "2022-07-01",
"interval": 0,
"cropId": 0
},
{
"id" : 5,
"name" : "look after plant",
"id": 5,
"name": "look after plant",
"description": "Look for pest or illness at the leaves of the plant. Check the soil around the plant, if the roots are enough covered with soil",
"startDate" : "2022-05-01",
"endDate" : "2022-09-01",
"interval" : 5,
"cropId" : 0
"startDate": "2022-05-01",
"endDate": "2022-09-01",
"interval": 5,
"cropId": 0
},
{
"id" : 6,
"name" : "harvest plant",
"id": 6,
"name": "harvest plant",
"description": "Pull the ripe vegetables out from the soil. Clean them with clear, fresh water. ",
"startDate" : "2022-09-01",
"endDate" : "2022-09-01",
"interval" : 0,
"cropId" : 0
"startDate": "2022-09-01",
"endDate": "2022-09-01",
"interval": 0,
"cropId": 0
}
]