From 7f364835bf5c4c3e1e81659495cdac20d8d028e6 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 11 Mar 2019 17:11:33 +0100 Subject: [PATCH] Extended function getReihungstestErgebnisPerson: excluding gebiete opt. Now questioning areas (gebiete) can be excluded when calculating the total Reihungstestpunkte. excluding gebiete should be defined in the config array FAS_REIHUNGSTEST_EXCLUDE_GEBIETE. --- config/global.config-default.inc.php | 4 ++++ include/pruefling.class.php | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config/global.config-default.inc.php b/config/global.config-default.inc.php index 45c3657cd..06fec388f 100644 --- a/config/global.config-default.inc.php +++ b/config/global.config-default.inc.php @@ -104,6 +104,10 @@ define('FAS_PRUEFUNG_BEI_NOTENEINGABE_ANLEGEN',false); //oder Prozentpunkte uebernommen werden true=Punkte, false=Prozentpunkte define('FAS_REIHUNGSTEST_PUNKTE', false); +// Legt fest, welche Reihungstestgebiete bei der Berechnung der Gesamtpunkte NICHT einbezogen werden. +// array(gebiet_id1, gebiet_id2,...) +define('FAS_REIHUNGSTEST_EXCLUDE_GEBIETE', array()); + // Legt fest ob Messages im FAS angezeigt werden true|false define('FAS_MESSAGES',false); diff --git a/include/pruefling.class.php b/include/pruefling.class.php index 2312e74e9..0364547d1 100644 --- a/include/pruefling.class.php +++ b/include/pruefling.class.php @@ -313,12 +313,25 @@ class pruefling extends basis_db * @param $person_id ID der Person. * @param $punkte Wenn true werden Punkte geliefert, sonst Prozentsumme. * @param $reihungstest_id ID des Reihungstests. + * @param $has_excluded_gebiete Wenn true werden die Punkte der Fragengebiete, die im config-array + * definiert sind, bei der Berechnung der Endpunkte nicht berücksichtigt. * @return Endpunkte des Reihungstests oder False wenn keine Punkte vorhanden */ - public function getReihungstestErgebnisPerson($person_id, $punkte=false, $reihungstest_id=null) + public function getReihungstestErgebnisPerson($person_id, $punkte=false, $reihungstest_id=null, $has_excluded_gebiete = false) { $qry = "SELECT * FROM testtool.vw_auswertung WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER); + + if ($has_excluded_gebiete) + { + if (defined('FAS_REIHUNGSTEST_EXCLUDE_GEBIETE') && !empty(FAS_REIHUNGSTEST_EXCLUDE_GEBIETE)) + { + $exclude_gebiet_id_arr = FAS_REIHUNGSTEST_EXCLUDE_GEBIETE; + $exclude_gebiet_id_toString = implode(', ', $exclude_gebiet_id_arr); + $qry .= " AND gebiet_id NOT IN (". $exclude_gebiet_id_toString. ")"; + } + } + $ergebnis=0; if(!is_null($reihungstest_id))