#7: (WIP) calculateDeleteDate
Some checks failed
Quality Check / Linting Check (push) Failing after 12s
Quality Check / Javadoc Check (push) Successful in 20s

This commit is contained in:
arminribic 2024-05-17 09:56:05 +02:00
parent d2e41c06f2
commit 331c5697f1
4 changed files with 14 additions and 5 deletions

Binary file not shown.

View file

@ -22,6 +22,7 @@ import java.time.LocalDate;
/** /**
* Controller for all locked treatments. * Controller for all locked treatments.
*
* @author Armin Ribic * @author Armin Ribic
* @author Dorian Nemec * @author Dorian Nemec
*/ */
@ -67,8 +68,8 @@ public class LockedTreatmentController {
return new SimpleStringProperty(nurse.getSurName() + ", " + nurse.getFirstName()); return new SimpleStringProperty(nurse.getSurName() + ", " + nurse.getFirstName());
} }
); );
this.columnDeleteDate.setCellValueFactory(cellData -> new SimpleStringProperty("coming soon") this.columnDeleteDate.setCellValueFactory(cellData -> new SimpleStringProperty(DateConverter.convertLocalDateToString(cellData.getValue().calculateDeleteDate())));
);
this.tableView.setItems(this.treatments); this.tableView.setItems(this.treatments);
} }
@ -85,8 +86,7 @@ public class LockedTreatmentController {
} }
@FXML @FXML
private void unlockTreatment() private void unlockTreatment() {
{
Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem(); Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem();
if (selectedItem == null) { if (selectedItem == null) {
return; return;

View file

@ -1,5 +1,6 @@
package de.hitec.nhplus.treatment; package de.hitec.nhplus.treatment;
import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.nurse.Nurse; import de.hitec.nhplus.nurse.Nurse;
import de.hitec.nhplus.patient.Patient; import de.hitec.nhplus.patient.Patient;
import de.hitec.nhplus.utils.DateConverter; import de.hitec.nhplus.utils.DateConverter;
@ -10,6 +11,7 @@ import javafx.beans.property.SimpleStringProperty;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.List;
import java.util.StringJoiner; import java.util.StringJoiner;
/** /**
@ -185,4 +187,9 @@ public class Treatment {
.add("Remarks: " + this.getRemarks()) .add("Remarks: " + this.getRemarks())
.toString(); .toString();
} }
public LocalDate calculateDeleteDate() {
LocalDate delteDate = DateConverter.convertStringToLocalDate(getDate()).plusYears(10);
return delteDate;
}
} }

View file

@ -11,6 +11,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -151,4 +152,5 @@ public class TreatmentDao extends DaoImp<Treatment> {
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery()); return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
} }
} }