#7: Automatisches Löschen nach 10Jahre implementiert und für
Some checks failed
Quality Check / Linting Check (push) Failing after 13s
Quality Check / Javadoc Check (push) Successful in 21s

#10: Nachtrag: Locked Nurses können nicht mehr zu neuen Treatments hinzugefügt werden
This commit is contained in:
arminribic 2024-05-17 11:37:20 +02:00
parent 5d92bb9b45
commit c852265649
4 changed files with 8 additions and 10 deletions

Binary file not shown.

View file

@ -138,7 +138,7 @@ public class AllTreatmentController {
this.patientSelection.add(patient.getSurName());
}
nurseList = (ArrayList<Nurse>) nurseDao.readAll();
nurseList = (ArrayList<Nurse>) nurseDao.readAllActive();
for (Nurse nurse : nurseList) {
this.nurseSelection.add(nurse.getSurName());
}

View file

@ -51,7 +51,6 @@ public class LockedTreatmentController {
* that is called after the binding of all the fields.
*/
public void initialize() {
handleDelete();
this.readAllAndShowInTableView();
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
@ -73,6 +72,7 @@ public class LockedTreatmentController {
this.tableView.setItems(this.treatments);
handleDelete();
}
private void readAllAndShowInTableView() {
@ -105,13 +105,13 @@ public class LockedTreatmentController {
@FXML
public void handleDelete() {
Treatment selecteditem;
LocalDate today = LocalDate.now();//Ändern!!!!!
LocalDate today = LocalDate.now();
LocalDate deleteDate;
for (int i = 0; i < treatments.size(); i++) {
selecteditem = treatments.get(i);
for (Treatment treatment : treatments) {
selecteditem = treatment;
deleteDate = selecteditem.calculateDeleteDate();
if (today.isEqual(deleteDate) || today.isBefore(deleteDate)) {
if (today.isEqual(deleteDate) || today.isAfter(deleteDate)) {
try {
treatmentDao.delete(selecteditem.getId());
System.out.println("Wird gelöscht");
@ -119,9 +119,8 @@ public class LockedTreatmentController {
exception.printStackTrace();
}
}
readAllAndShowInTableView();
}
}

View file

@ -189,7 +189,6 @@ public class Treatment {
}
public LocalDate calculateDeleteDate() {
LocalDate delteDate = DateConverter.convertStringToLocalDate(getDate()).plusYears(10);
return delteDate;
return DateConverter.convertStringToLocalDate(getDate()).plusYears(10);
}
}