#23 add Task generation watertask
This commit is contained in:
parent
4072308ae6
commit
233ce6b088
|
@ -1,12 +1,7 @@
|
|||
package ch.zhaw.gartenverwaltung.bootstrap;
|
||||
|
||||
import ch.zhaw.gartenverwaltung.HelloApplication;
|
||||
import ch.zhaw.gartenverwaltung.io.CropList;
|
||||
import ch.zhaw.gartenverwaltung.io.JsonCropList;
|
||||
import ch.zhaw.gartenverwaltung.io.JsonPlantList;
|
||||
import ch.zhaw.gartenverwaltung.io.JsonTaskList;
|
||||
import ch.zhaw.gartenverwaltung.io.PlantList;
|
||||
import ch.zhaw.gartenverwaltung.io.TaskList;
|
||||
import ch.zhaw.gartenverwaltung.io.*;
|
||||
import ch.zhaw.gartenverwaltung.models.Garden;
|
||||
import ch.zhaw.gartenverwaltung.models.GardenSchedule;
|
||||
import ch.zhaw.gartenverwaltung.models.PlantListModel;
|
||||
|
@ -37,6 +32,7 @@ public class AppLoader {
|
|||
private final TaskList taskList = new JsonTaskList();
|
||||
|
||||
private final GardenSchedule gardenSchedule = new GardenSchedule(taskList, plantList);
|
||||
private final WeatherGradenTaskPlanner weatherGradenTaskPlanner = new WeatherGradenTaskPlanner(taskList,plantList,cropList);
|
||||
private final Garden garden = new Garden(gardenSchedule, cropList);
|
||||
|
||||
|
||||
|
|
|
@ -52,9 +52,14 @@ public class GardenSchedule {
|
|||
for (GrowthPhase growthPhase : plant.lifecycleForGroup(growPhaseGroup)) {
|
||||
for (TaskTemplate taskTemplate : growthPhase.taskTemplates()) {
|
||||
addTask(taskTemplate.generateTask(crop.getStartDate(), crop.getCropId().orElse(0L)));
|
||||
//TODO add wateringtask
|
||||
|
||||
}
|
||||
//TODO add wateringtask
|
||||
if(growthPhase.wateringCycle() != null){
|
||||
addTask(new Task("watering Task", "pour water over the plant circa : "+ growthPhase.wateringCycle().litersPerSqM() +" per square meter",
|
||||
growthPhase.startDate().atYear(LocalDate.now().getYear()), growthPhase.endDate().atYear(LocalDate.now().getYear()),
|
||||
growthPhase.wateringCycle().interval(), crop.getCropId().orElse(0L)));
|
||||
}
|
||||
//growthPhase.wateringCycle()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ public class Task {
|
|||
nextExecution = startDate;
|
||||
this.cropId = cropId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for weather events
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue