From 3f88bba9bb9a812a1503b37f1a31e84ab4915e82 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 20 Dec 2023 12:06:45 +0100 Subject: [PATCH] =?UTF-8?q?Negative=20Pr=C3=BCfungen=20sortiert=20und=20be?= =?UTF-8?q?i=20bestehenden=20Antr=C3=A4gen=20nach=20Antragsdatum=20und=20S?= =?UTF-8?q?tdsem=20gefiltert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/components/Antrag/Wiederholung.php | 3 +-- application/libraries/AntragLib.php | 6 ++++-- application/models/education/Pruefung_model.php | 11 ++++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/application/controllers/components/Antrag/Wiederholung.php b/application/controllers/components/Antrag/Wiederholung.php index 515771224..418d05f45 100644 --- a/application/controllers/components/Antrag/Wiederholung.php +++ b/application/controllers/components/Antrag/Wiederholung.php @@ -76,10 +76,9 @@ class Wiederholung extends FHC_Controller if (isError($result)) { return $this->outputJsonError(getError($result)); } - $data = getData($result); - $result = $this->antraglib->getFailedExamForPrestudent($prestudent_id); + $result = $this->antraglib->getFailedExamForPrestudent($prestudent_id, $data->datum, $data->studiensemester_kurzbz); // NOTE(chris): error handling for this function should already happenden in antraglib->getPrestudentWiederholungsBerechtigt() $pruefungsdata = current(getData($result)); diff --git a/application/libraries/AntragLib.php b/application/libraries/AntragLib.php index 96c1a90d8..335bfab27 100644 --- a/application/libraries/AntragLib.php +++ b/application/libraries/AntragLib.php @@ -1499,6 +1499,8 @@ class AntragLib $resultDetails->grund = $resultAntrag->grund; $resultDetails->studierendenantrag_id = $resultAntrag->studierendenantrag_id; $resultDetails->typ = $resultAntrag->typ; + $resultDetails->datum = $resultAntrag->datum; + $resultDetails->studiensemester_kurzbz = $resultAntrag->studiensemester_kurzbz; return success($resultDetails); } @@ -1600,9 +1602,9 @@ class AntragLib ); } - public function getFailedExamForPrestudent($prestudent_id) + public function getFailedExamForPrestudent($prestudent_id, $max_date = null, $studiensemester_kurzbz = null) { - return $this->_ci->PruefungModel->loadWhereCommitteeExamFailedForPrestudent($prestudent_id); + return $this->_ci->PruefungModel->loadWhereCommitteeExamFailedForPrestudent($prestudent_id, $max_date, $studiensemester_kurzbz); } public function saveLvs($lvArray) diff --git a/application/models/education/Pruefung_model.php b/application/models/education/Pruefung_model.php index e1d668293..50109d2f1 100644 --- a/application/models/education/Pruefung_model.php +++ b/application/models/education/Pruefung_model.php @@ -139,6 +139,8 @@ class Pruefung_model extends DB_Model $this->db->where_not_in("n.note", $note_blacklist); $this->db->where_in("p.pruefungstyp_kurzbz", ['kommPruef','zusKommPruef']); + $this->addOrder('p.datum', 'DESC'); + return $this->load(); } @@ -201,12 +203,19 @@ class Pruefung_model extends DB_Model * * @return stdClass */ - public function loadWhereCommitteeExamFailedForPrestudent($prestudent_id) + public function loadWhereCommitteeExamFailedForPrestudent($prestudent_id, $max_date = null, $studiensemester_kurzbz = null) { $this->withDetailsForStudierendenAntrag(); $this->db->where('ps.prestudent_id', $prestudent_id); + if ($max_date !== null) { + $this->db->where('p.datum <', $max_date); + } + if ($studiensemester_kurzbz !== null) { + $this->db->where('le.studiensemester_kurzbz', $studiensemester_kurzbz); + } + return $this->loadWhereCommitteeExamsFailed(); }