diff --git a/src/main/java/ch/zhaw/gartenverwaltung/backgroundtasks/weather/WeatherGradenTaskPlanner.java b/src/main/java/ch/zhaw/gartenverwaltung/backgroundtasks/weather/WeatherGradenTaskPlanner.java index 7c6a3ee..d36962a 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/backgroundtasks/weather/WeatherGradenTaskPlanner.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/backgroundtasks/weather/WeatherGradenTaskPlanner.java @@ -33,11 +33,11 @@ public class WeatherGradenTaskPlanner { private void getSevereWeatherEvents() throws IOException { SevereWeather actualWeather = weatherService.causeSevereWeather(1); if (SevereWeather.HAIL.equals(actualWeather)) { - createPreHail(); + createPreHailTask(); } else if (SevereWeather.FROST.equals(actualWeather)) { - createPreFrost(); + createPreFrostTask(); } else if (SevereWeather.SNOW.equals(actualWeather)) { - createPreSnow(); + createPreSnowTask(); } } @@ -46,7 +46,7 @@ public class WeatherGradenTaskPlanner { adjustWateringTask(rainAmount); } - public void createPreHail() throws IOException { + public void createPreHailTask() throws IOException { Task preHailTask = new Task("Hail", "During a summer Thunderstorm it could hail heavily. THe Hail could damage the crops. To prevent damage cover the plants with a strong tarpaulin", @@ -55,14 +55,14 @@ public class WeatherGradenTaskPlanner { } - public void createPreFrost() throws IOException { + public void createPreFrostTask() throws IOException { Task preFrostTask = new Task("Frost", "The temperatur falls below zero degrees, cover especially the root with wool", dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L)); taskList.saveTask(preFrostTask); } - public void createPreSnow() throws IOException { + public void createPreSnowTask() throws IOException { Task preSnowTask = new Task("Snow", "The weather brings little snowfall. Cover your crops", dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L)); @@ -75,13 +75,13 @@ public class WeatherGradenTaskPlanner { Plant plant = plantList.getPlantById(HardinessZone.ZONE_8A,crop.getPlantId()).orElseThrow(PlantNotFoundException::new); if(plant.wateringCycle().litersPerSqM() < rainAmount){ - adjustNextExecutionOfWateringTask(taskList.getTaskList(LocalDate.now(), LocalDate.now().plusDays(7))); + adjustNextExecutionOfWateringTasks(taskList.getTaskList(LocalDate.now(), LocalDate.now().plusDays(7))); } } } // vom startdatum abhängig, - private void adjustNextExecutionOfWateringTask(List cropTaskList){ + private void adjustNextExecutionOfWateringTasks(List cropTaskList){ for(Task task : cropTaskList){ if(task.getName().equals("water plant")){ task.setNextExecution(task.getNextExecution().plusDays(task.getInterval().orElse(1)));