#7: Automatisches Löschen nach 10Jahre implementiert und für
#10: Nachtrag: Locked Nurses können nicht mehr zu neuen Treatments hinzugefügt werden
This commit is contained in:
parent
5d92bb9b45
commit
c852265649
4 changed files with 8 additions and 10 deletions
Binary file not shown.
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue