#23 bugfix adjust task
This commit is contained in:
parent
5e42cae290
commit
a29066ed05
|
@ -16,7 +16,7 @@ public class WeatherGradenTaskPlanner {
|
||||||
private final PlantList plantList;
|
private final PlantList plantList;
|
||||||
private final CropList cropList;
|
private final CropList cropList;
|
||||||
WeatherService weatherService;
|
WeatherService weatherService;
|
||||||
private final LocalDate dateSevereWeather = LocalDate.of(22,12,15);
|
private final LocalDate dateSevereWeather = LocalDate.of(2022,12,15);
|
||||||
|
|
||||||
public WeatherGradenTaskPlanner(TaskList taskList, PlantList plantList, CropList cropList) {
|
public WeatherGradenTaskPlanner(TaskList taskList, PlantList plantList, CropList cropList) {
|
||||||
this.taskList = taskList;
|
this.taskList = taskList;
|
||||||
|
@ -31,7 +31,7 @@ public class WeatherGradenTaskPlanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getSevereWeatherEvents() throws IOException {
|
private void getSevereWeatherEvents() throws IOException {
|
||||||
SevereWeather actualWeather = weatherService.causeSevereWeather(0);
|
SevereWeather actualWeather = weatherService.causeSevereWeather(1);
|
||||||
if (SevereWeather.HAIL.equals(actualWeather)) {
|
if (SevereWeather.HAIL.equals(actualWeather)) {
|
||||||
createPreHail();
|
createPreHail();
|
||||||
} else if (SevereWeather.FROST.equals(actualWeather)) {
|
} else if (SevereWeather.FROST.equals(actualWeather)) {
|
||||||
|
@ -50,8 +50,7 @@ public class WeatherGradenTaskPlanner {
|
||||||
|
|
||||||
Task preHailTask = new Task("Hail",
|
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",
|
"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.minusDays(1L),dateSevereWeather.plusDays(1L));
|
||||||
preHailTask.withId(Long.MAX_VALUE);
|
|
||||||
taskList.saveTask(preHailTask);
|
taskList.saveTask(preHailTask);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -59,16 +58,14 @@ public class WeatherGradenTaskPlanner {
|
||||||
public void createPreFrost() throws IOException {
|
public void createPreFrost() throws IOException {
|
||||||
Task preFrostTask = new Task("Frost",
|
Task preFrostTask = new Task("Frost",
|
||||||
"The temperatur falls below zero degrees, cover especially the root with wool",
|
"The temperatur falls below zero degrees, cover especially the root with wool",
|
||||||
dateSevereWeather.minusDays(1L));
|
dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L));
|
||||||
preFrostTask.withId(Long.MAX_VALUE);
|
|
||||||
taskList.saveTask(preFrostTask);
|
taskList.saveTask(preFrostTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createPreSnow() throws IOException {
|
public void createPreSnow() throws IOException {
|
||||||
Task preSnowTask = new Task("Snow",
|
Task preSnowTask = new Task("Snow",
|
||||||
"The weather brings little snowfall. Cover your crops",
|
"The weather brings little snowfall. Cover your crops",
|
||||||
dateSevereWeather.minusDays(1L));
|
dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L));
|
||||||
preSnowTask.withId(Long.MAX_VALUE);
|
|
||||||
taskList.saveTask(preSnowTask);
|
taskList.saveTask(preSnowTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,11 @@ public class Task {
|
||||||
/**
|
/**
|
||||||
* Constructor for weather events
|
* Constructor for weather events
|
||||||
*/
|
*/
|
||||||
public Task(String name, String description, LocalDate startDate) {
|
public Task(String name, String description, LocalDate startDate, LocalDate endDate) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task(String name, String description, LocalDate startDate, LocalDate endDate, int interval, long cropId) {
|
public Task(String name, String description, LocalDate startDate, LocalDate endDate, int interval, long cropId) {
|
||||||
|
|
Loading…
Reference in New Issue