add logic for config FAS_REIHUNGSTEST_EXCLUDE_GEBIETE

This commit is contained in:
ma0068
2025-12-11 10:53:15 +01:00
parent 1176c8d6e4
commit f40f554c6b
6 changed files with 87 additions and 31 deletions
@@ -28,7 +28,7 @@ class Studentenverwaltung extends Auth_Controller
'basis/prestudentstatus' => $this->permissionlib->isBerechtigt('basis/prestudentstatus'),
'assistenz_stgs' => $this->permissionlib->getSTG_isEntitledFor('assistenz'),
'admin' => $this->permissionlib->isBerechtigt('admin'),
'assistenz_schreibrechte' => $this->permissionlib->isBerechtigt('assistenz','suid'),
'assistenz_schreibrechte' => $this->permissionlib->isBerechtigt('assistenz', 'suid'),
'student/keine_studstatuspruefung' => $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung'),
'lehre/reihungstestAufsicht' => $this->permissionlib->isBerechtigt('lehre/reihungstestAufsicht'),
'system/change_outputformat' => $this->permissionlib->getOE_isEntitledFor('system/change_outputformat'),
@@ -39,3 +39,5 @@ class Studentenverwaltung extends Auth_Controller
]);
}
}
@@ -392,6 +392,7 @@ class Aufnahmetermine extends FHCAPI_Controller
$person_id = $this->input->get('person_id');
$punkte = $this->input->get('punkte');
$reihungstest_id = $this->input->get('reihungstest_id');
$has_excluded_gebiete = $this->input->get('hasExcludedAreas');
if(!$reihungstest_id)
{
@@ -402,22 +403,27 @@ class Aufnahmetermine extends FHCAPI_Controller
$studiengang_kz = $this->input->get('studiengang_kz');
$this->load->model('testtool/Ablauf_model', 'AblaufModel');
$result = $this->AblaufModel->getAblaufGebieteAndGewichte($studiengang_kz);
$result = $this->AblaufModel->getAblaufGebieteAndGewichte($studiengang_kz, 1);
$data = $this->getDataOrTerminateWithError($result);
$weightedArray = [];
$basis_gebiet_id_arr = [];
$basis_gebiet_id_toString = '';
foreach ($data as $abl)
{
$weightedArray[$abl->gebiet_id] = $abl->gewicht;
$basis_gebiet_id_arr[]= $abl->gebiet_id;
}
$basis_gebiet_id_toString = implode(', ', $basis_gebiet_id_arr);
$result = $this->ReihungstestModel->getReihungstestErgebnisPerson($person_id, $punkte, $reihungstest_id, $weightedArray);
/* if (isError($result))
{
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}*/
$result = $this->ReihungstestModel->getReihungstestErgebnisPerson(
$person_id,
$punkte,
$reihungstest_id,
$weightedArray,
$has_excluded_gebiete,
$basis_gebiet_id_toString
);
$this->terminateWithSuccess($result);
}
+53 -15
View File
@@ -10,7 +10,7 @@ class Reihungstest_model extends DB_Model
parent::__construct();
$this->dbTable = 'public.tbl_reihungstest';
$this->pk = 'reihungstest_id';
}
}
/**
* Gets a test from a test id only if it is available
@@ -42,8 +42,8 @@ class Reihungstest_model extends DB_Model
/**
* Checks if there are active studyplans which have no public placement tests assigned yet.
* Only check assignment to studyplans that are
* - Bachelor,
* - active,
* - Bachelor,
* - active,
* - set as online application
* - valid for 1st terms
* @return array Returns object array with studyplans that have no public placement tests assigned yet.
@@ -97,7 +97,7 @@ class Reihungstest_model extends DB_Model
USING (reihungstest_id)
WHERE
datum >= now()
AND
AND
oeffentlich = \'t\'
)
';
@@ -105,7 +105,7 @@ class Reihungstest_model extends DB_Model
return $this->execQuery($query);
}
/**
/**
* Gets amount of free places.
* @return array Returns object array with faculty and amount of free places
* for each public actual placement test date.
@@ -432,10 +432,10 @@ class Reihungstest_model extends DB_Model
}
/**
* Loads all applicants of a placement test
* @param integer $reihungstest_id ID of placement test
* @return array Returns object array with data of applicants.
*/
* Loads all applicants of a placement test
* @param integer $reihungstest_id ID of placement test
* @return array Returns object array with data of applicants.
*/
public function getApplicantsOfPlacementTest($reihungstest_id)
{
$query = '
@@ -556,13 +556,22 @@ class Reihungstest_model extends DB_Model
* Calculates Result of Placement Test for a given Person and given placementtest
* and with taking account of weighting per area
*
* @param $person_id ID of Person
* @param $punkte if true result is points else result is percentage of sum
* @param $reihungstest_id ID of Placementtest
* @param $weightedArray array of weighting per area (gewicht per gebiet_id)
* @return float result
* @param Number $person_id ID of Person
* @param Boolean $punkte if true result is points else result is percentage of sum
* @param Number $reihungstest_id ID of Placementtest
* @param Array $weightedArray array of weighting per area (gewicht per gebiet_id)
* @param Boolean $has_excluded_gebiete if true, areas in the configArray will be excluded
* @param Array $basis_gebiet_id_toString areas to exclude
* @return float result points of RT
*/
public function getReihungstestErgebnisPerson($person_id, $punkte, $reihungstest_id, $weightedArray = null)
public function getReihungstestErgebnisPerson(
$person_id,
$punkte,
$reihungstest_id,
$weightedArray = null,
$has_excluded_gebiete = false,
$basis_gebiet_id_toString = null
)
{
$parametersArray = array($reihungstest_id);
@@ -577,6 +586,35 @@ class Reihungstest_model extends DB_Model
WHERE
reihungstest_id = ? ";
//areas of Studiengang
if (!empty($basis_gebiet_id_toString))
{
$qry .= "
AND
gebiet_id IN (". $basis_gebiet_id_toString. ")
";
}
//areas to exclude
if($has_excluded_gebiete)
{
if (defined('FAS_REIHUNGSTEST_EXCLUDE_GEBIETE') && !empty(FAS_REIHUNGSTEST_EXCLUDE_GEBIETE))
{
$excluded_gebiete = unserialize(FAS_REIHUNGSTEST_EXCLUDE_GEBIETE);
$exclude_gebiet_id_arr = $excluded_gebiete;
if (is_array($exclude_gebiet_id_arr) && count($exclude_gebiet_id_arr) > 0)
{
$exclude_gebiet_id_toString = implode(', ', $exclude_gebiet_id_arr);
$qry .= "
AND
gebiet_id NOT IN (". $exclude_gebiet_id_toString. ")
-- AND
-- typ = 'b'
";
}
}
}
//using prestudent Status to avoid to get the sum of more than 1 placement tests
$qry .= "
AND prestudent_id = (
@@ -45,6 +45,7 @@ $configArray = [
'showAufnahmegruppen' => !defined('FAS_REIHUNGSTEST_AUFNAHMEGRUPPEN') ? false : FAS_REIHUNGSTEST_AUFNAHMEGRUPPEN,
'allowUebernahmePunkte' => !defined('FAS_REIHUNGSTEST_PUNKTEUEBERNAHME') ? true : FAS_REIHUNGSTEST_PUNKTEUEBERNAHME,
'useReihungstestPunkte' => !defined('FAS_REIHUNGSTEST_PUNKTE') ? true : FAS_REIHUNGSTEST_PUNKTE,
'hasExcludedAreas' => defined('FAS_REIHUNGSTEST_EXCLUDE_GEBIETE') && !empty(FAS_REIHUNGSTEST_EXCLUDE_GEBIETE),
];
?>
@@ -84,6 +84,7 @@ export default {
configShowAufnahmegruppen: this.config.showAufnahmegruppen,
configAllowUebernahmePunkte: this.config.allowUebernahmePunkte,
configUseReihungstestPunkte: this.config.useReihungstestPunkte,
configHasExcludedAreas: this.config.hasExcludedAreas,
appConfig: Vue.computed(() => this.appconfig)
}
},
@@ -23,6 +23,10 @@ export default {
from: 'configUseReihungstestPunkte',
default: true
},
hasExcludedAreas: {
from: 'configHasExcludedAreas',
default: false
},
$reloadList: {
from: '$reloadList',
required: true
@@ -123,7 +127,7 @@ export default {
{title: "studienplan_id", field: "studienplan_id", visible: false},
//{title: "stg", field: "studiengangkurzbzlang"},
{title: "stg_ber", field: "studiengangkurzbzlang_ber"},
{title: "stg_kz", field: "studiengang_kz_ber", visible: false},
{title: "Stg_Kz", field: "studiengang_kz_ber", visible: false},
{
title: 'Aktionen', field: 'actions',
minWidth: 150, // Ensures Action-buttons will be always fully displayed
@@ -136,7 +140,7 @@ export default {
button.innerHTML = '<i class="fa fa-edit"></i>';
button.title = this.$p.t('ui', 'bearbeiten');
button.addEventListener('click', (event) =>
this.actionEditPlacementTest(cell.getData().rt_person_id)
this.actionEditPlacementTest(cell.getData().rt_person_id, cell.getData().studiengang_kz_ber)
);
container.append(button);
@@ -219,7 +223,8 @@ export default {
listStudyPlans: [],
filterOnlyFutureTestsSet: false,
filteredPlacementTests: [],
youngestSemester: null
youngestSemester: null,
stgRtPers: null
}
},
methods: {
@@ -229,11 +234,12 @@ export default {
this.formData.anmeldedatum = new Date();
this.$refs.placementTestModal.show();
},
actionEditPlacementTest(rt_person_id) {
actionEditPlacementTest(rt_person_id, stg_kz) {
this.resetForm();
this.statusNew = false;
this.loadPlacementTest(rt_person_id);
this.$refs.placementTestModal.show();
this.stgRtPers = stg_kz;
},
actionDeletePlacementTest(rt_person_id) {
this.$fhcAlert
@@ -303,12 +309,13 @@ export default {
this.reload();
});
},
getResultReihungstest(reihungstest_id){
getResultReihungstest(reihungstest_id, stg_kz){
const paramsRt = {
reihungstest_id: reihungstest_id,
person_id: this.student.person_id,
punkte: this.useReihungstestPunkte,
studiengang_kz: this.student.studiengang_kz
studiengang_kz: stg_kz,
hasExcludedAreas: this.hasExcludedAreas
};
return this.$api
@@ -362,6 +369,7 @@ export default {
},
resetForm() {
this.formData = {};
this.stgRtPers = null;
},
parseSemester(semester) {
const type = semester.slice(0, 2).toUpperCase(); // "WS" or "SS"
@@ -528,7 +536,7 @@ export default {
<div v-if="allowUebernahmePunkte" class="col-4">
<label class="form-label" style="color:transparent;">getPunkte</label>
<button class="btn btn-outline-secondary w-100" @click="getResultReihungstest(formData.rt_id)">{{ $p.t('admission', 'getRTErgebnis') }}</button>
<button class="btn btn-outline-secondary w-100" @click="getResultReihungstest(formData.rt_id, stgRtPers)">{{ $p.t('admission', 'getRTErgebnis') }}</button>
</div>
</div>