From 8f974e89029bf451e40cb2716f257c3256212b3e Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 3 Dec 2025 08:37:38 +0100 Subject: [PATCH] sql angepasst --- application/controllers/api/frontend/v1/LvPlan.php | 3 +-- application/models/ressource/Stundenplan_model.php | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/application/controllers/api/frontend/v1/LvPlan.php b/application/controllers/api/frontend/v1/LvPlan.php index 257c04960..571af6876 100644 --- a/application/controllers/api/frontend/v1/LvPlan.php +++ b/application/controllers/api/frontend/v1/LvPlan.php @@ -181,9 +181,8 @@ class LvPlan extends FHCAPI_Controller $this->load->library('StundenplanLib'); $result = $this->stundenplanlib->getEventsByLV($lv_id, $start_date, $end_date, $stundenplan); - $lvplanEvents = $this->getDataOrTerminateWithError($result); - $this->terminateWithSuccess($lvplanEvents); + $this->terminateWithSuccess(hasData($result) ? getData($result) : []); } //TODO: delete this function if we don't use the old calendar export endpoints anymore diff --git a/application/models/ressource/Stundenplan_model.php b/application/models/ressource/Stundenplan_model.php index 6e20a3bc2..c5cfa34d1 100644 --- a/application/models/ressource/Stundenplan_model.php +++ b/application/models/ressource/Stundenplan_model.php @@ -350,13 +350,17 @@ class Stundenplan_model extends DB_Model { $qry = " WITH lehreinheiten AS ( - SELECT lehreinheit_id FROM lehre.tbl_lehreinheit WHERE lehrveranstaltung_id = ? + SELECT lehreinheit_id + FROM lehre.tbl_lehreinheit + JOIN tbl_studiensemester USING(studiensemester_kurzbz) + WHERE lehrveranstaltung_id = ? + AND tbl_studiensemester.start >= ? AND tbl_studiensemester.ende <= ? ), " . $this->getStundenplanCTE($stundenplan) . " SELECT * FROM stundenplanentries "; - return $this->execReadOnlyQuery($qry, array($lehrveranstaltung_id, $start_date, $end_date)); + return $this->execReadOnlyQuery($qry, array($lehrveranstaltung_id, $start_date, $end_date, $start_date, $end_date)); } private function getStundenplanCTE($stundenplan)