fix of zero interval
This commit is contained in:
@@ -22,6 +22,7 @@ import javafx.scene.control.*;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@@ -205,22 +206,28 @@ public class CropDetailController {
|
||||
}
|
||||
|
||||
private HBox createTaskHBox(Task task) {
|
||||
HBox hBox = new HBox();
|
||||
HBox hBox = new HBox(10);
|
||||
Label taskName = new Label(task.getName()+": ");
|
||||
taskName.setMinWidth(100);
|
||||
taskName.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
taskName.setStyle("-fx-font-weight: bold");
|
||||
Label taskDescription = new Label(task.getDescription());
|
||||
taskDescription.setWrapText(true);
|
||||
taskDescription.setMaxWidth(2000);
|
||||
HBox.setHgrow(taskDescription, Priority.ALWAYS);
|
||||
taskDescription.setMaxSize(600, Double.MAX_VALUE);
|
||||
Pane puffer = new Pane();
|
||||
HBox.setHgrow(puffer, Priority.ALWAYS);
|
||||
|
||||
|
||||
Button edit = new Button();
|
||||
Button delete = new Button();
|
||||
HBox.setHgrow(edit, Priority.NEVER);
|
||||
HBox.setHgrow(delete, Priority.NEVER);
|
||||
setIconToButton(edit, "editIcon.png");
|
||||
setIconToButton(delete, "deleteIcon.png");
|
||||
edit.setOnAction(getEditTaskEvent(task));
|
||||
delete.setOnAction(deleteTask(task));
|
||||
|
||||
hBox.getChildren().addAll(taskName, taskDescription, edit, delete);
|
||||
hBox.getChildren().addAll(taskName, taskDescription, puffer, edit, delete);
|
||||
return hBox;
|
||||
}
|
||||
|
||||
@@ -229,12 +236,15 @@ public class CropDetailController {
|
||||
label.setStyle("-fx-font-weight: bold");
|
||||
HBox hBox = new HBox();
|
||||
hBox.fillHeightProperty();
|
||||
Label label1 = new Label(pest.description());
|
||||
label1.setAlignment(Pos.TOP_LEFT);
|
||||
label1.setWrapText(true);
|
||||
label1.setMaxWidth(600);
|
||||
Label description = new Label(pest.description());
|
||||
description.setAlignment(Pos.TOP_LEFT);
|
||||
description.setWrapText(true);
|
||||
description.setMaxWidth(600);
|
||||
Pane puffer = new Pane();
|
||||
HBox.setHgrow(puffer, Priority.ALWAYS);
|
||||
Button button = new Button("Get Counter Measures");
|
||||
hBox.getChildren().addAll(label, label1, button);
|
||||
HBox.setHgrow(button, Priority.NEVER);
|
||||
hBox.getChildren().addAll(label, description, puffer, button);
|
||||
return hBox;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ public class GardenSchedule {
|
||||
if (date.equals(checkDate) && !date.isAfter(task.getEndDate().orElse(LocalDate.MIN))) {
|
||||
dayTaskList.get(finalI).add(task);
|
||||
}
|
||||
if (task.getInterval().orElse(0) == 0) break;
|
||||
checkDate = checkDate.plusDays(task.getInterval().orElse(0));
|
||||
} while (task.getInterval().isPresent() && checkDate.isBefore(LocalDate.now().plusDays(listLength)));
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ public class Task {
|
||||
private LocalDate nextExecution;
|
||||
private LocalDate nextNotification;
|
||||
private long cropId;
|
||||
private boolean done;
|
||||
|
||||
/**
|
||||
* default constructor
|
||||
@@ -69,7 +70,7 @@ public class Task {
|
||||
}
|
||||
|
||||
public void done(){
|
||||
if(interval != null && !nextExecution.plusDays(interval).isAfter(endDate)){
|
||||
if(interval != null && interval != 0 && !nextExecution.plusDays(interval).isAfter(endDate)){
|
||||
nextExecution = nextExecution.plusDays(interval);
|
||||
} else {
|
||||
nextExecution = null;
|
||||
|
||||
Reference in New Issue
Block a user