From 09097c620580952bc690856845ee8d5be1d114db Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 13 Mar 2019 12:59:36 +0100 Subject: [PATCH] Corrected function getReihungstestErgebnisPerson Now the prestudent_id is retrieved by joining on study semester (instead of studienplan, which was inconsistent). Added also restricion on stufe = 1 to retrieve only Reihungstest absolved on desktop. --- include/pruefling.class.php | 42 ++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/include/pruefling.class.php b/include/pruefling.class.php index 0364547d1..071d7a1a1 100644 --- a/include/pruefling.class.php +++ b/include/pruefling.class.php @@ -342,20 +342,34 @@ class pruefling extends basis_db // die den Reihungstest oefter im selben Studiengang gemacht haben nicht das // Ergebniss der beiden Tests summiert bekommen // Im Zweifelsfall wird der neuere Reihungstest genommen - $qry.= " AND prestudent_id = ( - SELECT - prestudent_id - FROM - public.tbl_rt_person - JOIN public.tbl_reihungstest ON(rt_id=reihungstest_id) - JOIN public.tbl_prestudent USING(person_id) - JOIN public.tbl_prestudentstatus USING(prestudent_id, studienplan_id) - WHERE - tbl_rt_person.person_id=".$this->db_add_param($person_id, FHC_INTEGER)." - AND tbl_rt_person.rt_id=".$this->db_add_param($reihungstest_id, FHC_INTEGER)." - AND tbl_prestudentstatus.status_kurzbz='Interessent' - ORDER BY - tbl_reihungstest.datum desc LIMIT 1)"; + $qry.= " + AND + prestudent_id = ( + SELECT + prestudent_id + FROM + public.tbl_rt_person + JOIN + public.tbl_prestudent USING(person_id) + JOIN + public.tbl_prestudentstatus USING (prestudent_id) + JOIN + tbl_reihungstest ON ( + tbl_rt_person.rt_id = tbl_reihungstest.reihungstest_id + AND + tbl_prestudentstatus.studiensemester_kurzbz = tbl_reihungstest.studiensemester_kurzbz + ) + WHERE + tbl_rt_person.person_id = ".$this->db_add_param($person_id, FHC_INTEGER)." + AND + tbl_rt_person.rt_id = ".$this->db_add_param($reihungstest_id, FHC_INTEGER)." + AND + tbl_prestudentstatus.status_kurzbz='Interessent' + AND + (tbl_reihungstest.stufe = 1 OR tbl_reihungstest.stufe IS NULL) + ORDER BY + tbl_reihungstest.datum desc LIMIT 1 + )"; } if($result = $this->db_query($qry))