#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.
*
* @author Armin Ribic
* @author Dorian Nemec
*/
@ -49,7 +50,7 @@ public class LockedTreatmentController {
* This method allows initializing a {@link LockedNurseController} object
* that is called after the binding of all the fields.
*/
public void initialize(){
public void initialize() {
this.readAllAndShowInTableView();
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
@ -67,8 +68,8 @@ public class LockedTreatmentController {
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);
}
@ -85,8 +86,7 @@ public class LockedTreatmentController {
}
@FXML
private void unlockTreatment()
{
private void unlockTreatment() {
Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem();
if (selectedItem == null) {
return;

View file

@ -1,5 +1,6 @@
package de.hitec.nhplus.treatment;
import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.nurse.Nurse;
import de.hitec.nhplus.patient.Patient;
import de.hitec.nhplus.utils.DateConverter;
@ -10,6 +11,7 @@ import javafx.beans.property.SimpleStringProperty;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.List;
import java.util.StringJoiner;
/**
@ -185,4 +187,9 @@ public class Treatment {
.add("Remarks: " + this.getRemarks())
.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.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
@ -151,4 +152,5 @@ public class TreatmentDao extends DaoImp<Treatment> {
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
}
}