Compare commits

...

1 commit

Author SHA1 Message Date
f6001ea6bd
NOTICKET: Bugfix for Treatment locking
All checks were successful
Quality Check / Linting Check (push) Successful in 13s
Quality Check / Javadoc Check (push) Successful in 22s
Quality Check / Linting Check (pull_request) Successful in 16s
Quality Check / Javadoc Check (pull_request) Successful in 49s
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-05-22 18:56:08 +02:00

View file

@ -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,6 +324,13 @@ public class AllTreatmentController {
}catch (SQLException exception){ }catch (SQLException exception){
exception.printStackTrace(); exception.printStackTrace();
} }
if (selectedItem.calculateDeleteDate().isBefore(today) || selectedItem.calculateDeleteDate().equals(today)){
try {
dao.delete(selectedItem.getId());
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
readAllAndShowInTableView(); readAllAndShowInTableView();
} }