Logik des AllTreatmentController angepasst(Treatments werden automatisch gelöscht wenn Sie 10+ Jahre alt sind und man auf 'sperren' drückt)
This commit is contained in:
parent
bf86f9fc84
commit
ac170c6bf0
1 changed files with 3 additions and 1 deletions
|
@ -312,6 +312,8 @@ public class AllTreatmentController {
|
||||||
@FXML
|
@FXML
|
||||||
public void handleLock(){
|
public void handleLock(){
|
||||||
Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
if (selectedItem == null){
|
if (selectedItem == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -322,7 +324,7 @@ public class AllTreatmentController {
|
||||||
}catch (SQLException exception){
|
}catch (SQLException exception){
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
if (selectedItem.calculateDeleteDate().isBefore(LocalDate.now())){
|
if (selectedItem.calculateDeleteDate().isBefore(today) || selectedItem.calculateDeleteDate().equals(today)){
|
||||||
try {
|
try {
|
||||||
dao.delete(selectedItem.getId());
|
dao.delete(selectedItem.getId());
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|
Loading…
Reference in a new issue