Compare commits

..

No commits in common. "d0c6525d7a5120d66c8938f1aaa5037dcce00085" and "564cecd4ffb6721e8f251a12143b3777ddf402e4" have entirely different histories.

2 changed files with 9 additions and 7 deletions

View File

@ -16,7 +16,7 @@ public class WeatherGradenTaskPlanner {
private final PlantList plantList;
private final CropList cropList;
WeatherService weatherService;
private final LocalDate dateSevereWeather = LocalDate.of(2022,12,15);
private final LocalDate dateSevereWeather = LocalDate.of(22,12,15);
public WeatherGradenTaskPlanner(TaskList taskList, PlantList plantList, CropList cropList) {
this.taskList = taskList;
@ -31,7 +31,7 @@ public class WeatherGradenTaskPlanner {
}
private void getSevereWeatherEvents() throws IOException {
SevereWeather actualWeather = weatherService.causeSevereWeather(1);
SevereWeather actualWeather = weatherService.causeSevereWeather(0);
if (SevereWeather.HAIL.equals(actualWeather)) {
createPreHail();
} else if (SevereWeather.FROST.equals(actualWeather)) {
@ -50,7 +50,8 @@ public class WeatherGradenTaskPlanner {
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",
dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L));
dateSevereWeather.minusDays(1L));
preHailTask.withId(Long.MAX_VALUE);
taskList.saveTask(preHailTask);
}
@ -58,14 +59,16 @@ public class WeatherGradenTaskPlanner {
public void createPreFrost() 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));
dateSevereWeather.minusDays(1L));
preFrostTask.withId(Long.MAX_VALUE);
taskList.saveTask(preFrostTask);
}
public void createPreSnow() throws IOException {
Task preSnowTask = new Task("Snow",
"The weather brings little snowfall. Cover your crops",
dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L));
dateSevereWeather.minusDays(1L));
preSnowTask.withId(Long.MAX_VALUE);
taskList.saveTask(preSnowTask);
}

View File

@ -44,11 +44,10 @@ public class Task {
/**
* Constructor for weather events
*/
public Task(String name, String description, LocalDate startDate, LocalDate endDate) {
public Task(String name, String description, LocalDate startDate) {
this.name = name;
this.description = description;
this.startDate = startDate;
this.endDate = endDate;
}
public Task(String name, String description, LocalDate startDate, LocalDate endDate, int interval, long cropId) {