Merge pull request 'NOTICKET: Bugfix for Treatment locking' (#52) from bugfixes into main
All checks were successful
Quality Check / Linting Check (push) Successful in 19s
Javadoc Deploy / Javadoc (push) Successful in 36s
Quality Check / Javadoc Check (push) Successful in 34s

Reviewed-on: #52
This commit is contained in:
Dominik Säume 2024-05-22 17:15:36 +00:00
commit 97373930ec

View file

@ -312,6 +312,8 @@ public class AllTreatmentController {
@FXML
public void handleLock(){
Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem();
LocalDate today = LocalDate.now();
if (selectedItem == null){
return;
}
@ -322,6 +324,13 @@ public class AllTreatmentController {
}catch (SQLException exception){
exception.printStackTrace();
}
if (selectedItem.calculateDeleteDate().isBefore(today) || selectedItem.calculateDeleteDate().equals(today)){
try {
dao.delete(selectedItem.getId());
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
readAllAndShowInTableView();
}