WIP improving notenimport with punktefeature

This commit is contained in:
Johann Hoffmann
2026-02-09 09:50:22 +01:00
parent 6cf7093293
commit decd514b22
4 changed files with 141 additions and 50 deletions
@@ -44,6 +44,20 @@ class Noten extends FHCAPI_Controller
$this->load->library('AuthLib', null, 'AuthLib'); $this->load->library('AuthLib', null, 'AuthLib');
$this->load->library('PhrasesLib'); $this->load->library('PhrasesLib');
// Loads LogLib with different debug trace levels to get data of the job that extends this class
// It also specify parameters to set database fields
$this->load->library('LogLib', array(
'classIndex' => 5,
'functionIndex' => 5,
'lineIndex' => 4,
'dbLogType' => 'API', // required
'dbExecuteUser' => 'RESTful API',
'requestId' => 'API',
'requestDataFormatter' => function ($data) {
return json_encode($data);
}
), 'logLib');
// Loads phrases system // Loads phrases system
$this->loadPhrases([ $this->loadPhrases([
@@ -235,10 +249,12 @@ class Noten extends FHCAPI_Controller
if (defined('CIS_GESAMTNOTE_GEWICHTUNG') && CIS_GESAMTNOTE_GEWICHTUNG) { if (defined('CIS_GESAMTNOTE_GEWICHTUNG') && CIS_GESAMTNOTE_GEWICHTUNG) {
// Lehreinheitsgewichtung // Lehreinheitsgewichtung
$punkte_vorschlag = round($punktesumme_gewichtet / $gewichtsumme, 2); $punkte_vorschlag = round($punktesumme_gewichtet / $gewichtsumme, 2);
$note_vorschlag = $this->NotenschluesselaufteilungModel->getNote($punkte_vorschlag, $lv_id, $sem_kurzbz); $note_vorschlag_result = $this->NotenschluesselaufteilungModel->getNote($punkte_vorschlag, $lv_id, $sem_kurzbz);
$note_vorschlag = $this->getDataOrTerminateWithError($note_vorschlag_result);
} else { } else {
$punkte_vorschlag = round($punktesumme / $anzahlnoten, 2); $punkte_vorschlag = round($punktesumme / $anzahlnoten, 2);
$note_vorschlag = $this->NotenschluesselaufteilungModel->getNote($punkte_vorschlag, $lv_id, $sem_kurzbz); $note_vorschlag_result = $this->NotenschluesselaufteilungModel->getNote($punkte_vorschlag, $lv_id, $sem_kurzbz);
$note_vorschlag = $this->getDataOrTerminateWithError($note_vorschlag_result);
} }
} else { } else {
if (defined('CIS_GESAMTNOTE_GEWICHTUNG') && CIS_GESAMTNOTE_GEWICHTUNG) { if (defined('CIS_GESAMTNOTE_GEWICHTUNG') && CIS_GESAMTNOTE_GEWICHTUNG) {
@@ -403,6 +419,11 @@ class Noten extends FHCAPI_Controller
} }
$studlist .= "</table>"; $studlist .= "</table>";
$this->logLib->logInfoDB(array('saveStudentenNoten', array(
'updatevon' => getAuthUID(),
'updateamum' => date('Y-m-d H:i:s')
), getAuthUID(), getAuthPersonId(), array($result->noten, $lv_id, $sem_kurzbz)));
// always send the mail, config toggles data contents // always send the mail, config toggles data contents
$this->sendFreigabeEmail($lektorFullName, $lvaFullName, count($result->noten), $emails, $studlist, $betreff); $this->sendFreigabeEmail($lektorFullName, $lvaFullName, count($result->noten), $emails, $studlist, $betreff);
@@ -505,21 +526,12 @@ class Noten extends FHCAPI_Controller
$typ = $result->typ; $typ = $result->typ;
$jetzt = date("Y-m-d H:i:s"); $jetzt = date("Y-m-d H:i:s");
// nachpruefungeintragen.php script calls query on campus.student_lehrveranstaltung to find a
// lehreinheit_id for lva_id -> lehreinheit should be determined prior to that in new benotungstool
// by retrieving it from students row in campus.vw_student_lehrveranstaltung earlier on
// $lehreinheit_id = getLehreinheit($db, $lvid, $student_uid, $stsem);
// $lehreinheit_id = $result->lehreinheit_id;
// $punkte = null;
if(isset($punkte) && $punkte >= 0) { if(isset($punkte) && $punkte >= 0) {
// Bei Punkteeingabe wird die Note nochmals geprueft und ggf korrigiert // Bei Punkteeingabe wird die Note nochmals geprueft und ggf korrigiert
$result = $this->NotenschluesselaufteilungModel->getNote($punkte, $lva_id, $stsem); $result = $this->NotenschluesselaufteilungModel->getNote($punkte, $lva_id, $stsem);
if(isError($result)) { if(isError($result)) {
$this->terminateWithError('notenspiegel hats zrissen'); $this->terminateWithError('Notenspiegel Error');
} else { } else {
$data = getData($result); $data = getData($result);
if($data != $note) if($data != $note)
@@ -533,7 +545,6 @@ class Noten extends FHCAPI_Controller
// TODO: more sophisticated empty check // TODO: more sophisticated empty check
if($note=='') if($note=='')
$note = 9; $note = 9;
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$this->load->model('organisation/Studiengang_model', 'StudiengangModel'); $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
@@ -549,7 +560,6 @@ class Noten extends FHCAPI_Controller
$this->terminateWithError('Kein gültiger Studiengang gefunden für ID: '.$studiengang_kz); $this->terminateWithError('Kein gültiger Studiengang gefunden für ID: '.$studiengang_kz);
} }
//Gesamtnote updaten //Gesamtnote updaten
$result = $this->LvgesamtnoteModel->getLvGesamtNoten($lva_id, $student_uid, $stsem); $result = $this->LvgesamtnoteModel->getLvGesamtNoten($lva_id, $student_uid, $stsem);
if(!isError($result) && !hasData($result)) { if(!isError($result) && !hasData($result)) {
@@ -576,6 +586,12 @@ class Noten extends FHCAPI_Controller
$res = $this->LvgesamtnoteModel->load($id->retval); $res = $this->LvgesamtnoteModel->load($id->retval);
if(hasData($res)) $lvgesamtnote = getData($res)[0]; if(hasData($res)) $lvgesamtnote = getData($res)[0];
} }
$this->logLib->logInfoDB(array('saveStudentPruefung insert lvnote', $res, array(
'insertvon' => getAuthUID(),
'insertamum' => date('Y-m-d H:i:s')
), getAuthUID(), getAuthPersonId(), $student_uid, $lva_id, $stsem, $note,$punkte, $jetzt));
} }
else if(!isError($result) && hasData($result)) else if(!isError($result) && hasData($result))
{ {
@@ -597,6 +613,10 @@ class Noten extends FHCAPI_Controller
if(hasData($res)) $lvgesamtnote = getData($res)[0]; if(hasData($res)) $lvgesamtnote = getData($res)[0];
} }
$this->logLib->logInfoDB(array('saveStudentPruefung update lvnote', $res, array(
'updatevon' => getAuthUID(),
'updateamum' => date('Y-m-d H:i:s')
), getAuthUID(), getAuthPersonId(), $student_uid, $lva_id, $stsem, $note,$punkte, $jetzt));
} }
// save pruefung after updating lvnote, since pruefungspunkte get loaded by lv punkte // save pruefung after updating lvnote, since pruefungspunkte get loaded by lv punkte
@@ -705,8 +725,10 @@ class Noten extends FHCAPI_Controller
if(hasData($res)) $pruefungenChanged['extraPruefung'] = getData($res); if(hasData($res)) $pruefungenChanged['extraPruefung'] = getData($res);
} }
} }
$this->logLib->logInfoDB(array('termin1 created',$res, getAuthUID(), getAuthPersonId()));
// Die Pruefung wird als Termin2 eingetragen // Die Pruefung wird als Termin2 eingetragen
$result2 = $this->LePruefungModel->getPruefungenByUidTypLvStudiensemester($student_uid, "Termin2", $lva_id, $stsem); $result2 = $this->LePruefungModel->getPruefungenByUidTypLvStudiensemester($student_uid, "Termin2", $lva_id, $stsem);
// if there is a termin 2 entry already update it // if there is a termin 2 entry already update it
@@ -729,6 +751,9 @@ class Noten extends FHCAPI_Controller
if(hasData($res)) $pruefungenChanged['savedPruefung'] = getData($res); if(hasData($res)) $pruefungenChanged['savedPruefung'] = getData($res);
} }
$this->logLib->logInfoDB(array('termin2 updated',$res, getAuthUID(), getAuthPersonId()));
} else if(!isError($result2) && !hasData($result2)) { } else if(!isError($result2) && !hasData($result2)) {
// new entry termin 2 // new entry termin 2
@@ -753,6 +778,9 @@ class Noten extends FHCAPI_Controller
$res = $this->LePruefungModel->load($id->retval); $res = $this->LePruefungModel->load($id->retval);
if(hasData($res)) $pruefungenChanged['savedPruefung'] = getData($res); if(hasData($res)) $pruefungenChanged['savedPruefung'] = getData($res);
} }
$this->logLib->logInfoDB(array('termin2 inserted',$res, getAuthUID(), getAuthPersonId()));
} }
} else if($typ == "Termin3" && defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN3') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN3) } else if($typ == "Termin3" && defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN3') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN3)
@@ -780,6 +808,8 @@ class Noten extends FHCAPI_Controller
if(hasData($res)) $pruefungenChanged['savedPruefung'] = getData($res); if(hasData($res)) $pruefungenChanged['savedPruefung'] = getData($res);
} }
$this->logLib->logInfoDB(array('termin3 updated',$res, getAuthUID(), getAuthPersonId()));
} else if(!isError($result3) && !hasData($result3)) { } else if(!isError($result3) && !hasData($result3)) {
// insert new termin3 // insert new termin3
@@ -805,6 +835,8 @@ class Noten extends FHCAPI_Controller
if(hasData($res)) $pruefungenChanged['savedPruefung'] = getData($res); if(hasData($res)) $pruefungenChanged['savedPruefung'] = getData($res);
} }
$this->logLib->logInfoDB(array('termin3 inserted',$res, getAuthUID(), getAuthPersonId()));
} }
} else { } else {
$this->terminateWithError($this->p->t('benotungstool', 'wrongPruefungType', [$student_uid, $typ]), 'general'); $this->terminateWithError($this->p->t('benotungstool', 'wrongPruefungType', [$student_uid, $typ]), 'general');
@@ -855,6 +887,9 @@ class Noten extends FHCAPI_Controller
$res = $this->LvgesamtnoteModel->load($id->retval); $res = $this->LvgesamtnoteModel->load($id->retval);
if(hasData($res)) $lvgesamtnote = getData($res)[0]; if(hasData($res)) $lvgesamtnote = getData($res)[0];
} }
$this->logLib->logInfoDB(array('saveNotenvorschlag update lv gesamtnote',$res, getAuthUID(), getAuthPersonId()));
} else if(!isError($result) && !hasData($result)) { } else if(!isError($result) && !hasData($result)) {
$id = $this->LvgesamtnoteModel->insert( $id = $this->LvgesamtnoteModel->insert(
array( array(
@@ -878,6 +913,8 @@ class Noten extends FHCAPI_Controller
$res = $this->LvgesamtnoteModel->load($id->retval); $res = $this->LvgesamtnoteModel->load($id->retval);
if(hasData($res)) $lvgesamtnote = getData($res)[0]; if(hasData($res)) $lvgesamtnote = getData($res)[0];
} }
$this->logLib->logInfoDB(array('saveNotenvorschlag insert lv gesamtnote',$res, getAuthUID(), getAuthPersonId()));
} }
$this->terminateWithSuccess(array($lvgesamtnote)); $this->terminateWithSuccess(array($lvgesamtnote));
@@ -895,6 +932,7 @@ class Noten extends FHCAPI_Controller
!property_exists($result, 'noten')) { !property_exists($result, 'noten')) {
$this->terminateWithError($this->p->t('global', 'missingParameters'), 'general'); $this->terminateWithError($this->p->t('global', 'missingParameters'), 'general');
} }
$lv_id = $result->lv_id; $lv_id = $result->lv_id;
$sem_kurzbz = $result->sem_kurzbz; $sem_kurzbz = $result->sem_kurzbz;
@@ -907,6 +945,11 @@ class Noten extends FHCAPI_Controller
$result = $this->LvgesamtnoteModel->getLvGesamtNoten($lv_id, $note->uid, $sem_kurzbz); $result = $this->LvgesamtnoteModel->getLvGesamtNoten($lv_id, $note->uid, $sem_kurzbz);
if(defined(CIS_GESAMTNOTE_PUNKTE) && CIS_GESAMTNOTE_PUNKTE) {
$note->note = $this->NotenschluesselaufteilungModel->getNote($note->punkte, $lv_id, $sem_kurzbz);
$this->addMeta($note);
}
if(!isError($result) && hasData($result)) { if(!isError($result) && hasData($result)) {
$lvgesamtnote = getData($result)[0]; $lvgesamtnote = getData($result)[0];
@@ -914,7 +957,7 @@ class Noten extends FHCAPI_Controller
[$lvgesamtnote->student_uid, $lvgesamtnote->studiensemester_kurzbz, $lvgesamtnote->lehrveranstaltung_id], [$lvgesamtnote->student_uid, $lvgesamtnote->studiensemester_kurzbz, $lvgesamtnote->lehrveranstaltung_id],
array( array(
'note' => trim($note->note), 'note' => trim($note->note),
'punkte' => null, 'punkte' => $note->punkte,
'benotungsdatum' => date("Y-m-d H:i:s"), 'benotungsdatum' => date("Y-m-d H:i:s"),
'updateamum' => date("Y-m-d H:i:s"), 'updateamum' => date("Y-m-d H:i:s"),
'updatevon' => getAuthUID() 'updatevon' => getAuthUID()
@@ -925,6 +968,9 @@ class Noten extends FHCAPI_Controller
$res = $this->LvgesamtnoteModel->load($id->retval); $res = $this->LvgesamtnoteModel->load($id->retval);
if(hasData($res)) $lvgesamtnote = getData($res)[0]; if(hasData($res)) $lvgesamtnote = getData($res)[0];
} }
$this->logLib->logInfoDB(array('saveNotenvorschlagBulk update lv gesamtnote',$res, getAuthUID(), getAuthPersonId()));
} else if(!isError($result) && !hasData($result)) { } else if(!isError($result) && !hasData($result)) {
$id = $this->LvgesamtnoteModel->insert( $id = $this->LvgesamtnoteModel->insert(
array( array(
@@ -932,7 +978,7 @@ class Noten extends FHCAPI_Controller
'lehrveranstaltung_id' => $lv_id, 'lehrveranstaltung_id' => $lv_id,
'studiensemester_kurzbz' => $sem_kurzbz, 'studiensemester_kurzbz' => $sem_kurzbz,
'note' => trim($note->note), 'note' => trim($note->note),
'punkte' => null, 'punkte' => $note->punkte,
'mitarbeiter_uid' => getAuthUID(), 'mitarbeiter_uid' => getAuthUID(),
'benotungsdatum' => date("Y-m-d H:i:s"), 'benotungsdatum' => date("Y-m-d H:i:s"),
'freigabedatum' => null, 'freigabedatum' => null,
@@ -948,6 +994,8 @@ class Noten extends FHCAPI_Controller
$res = $this->LvgesamtnoteModel->load($id->retval); $res = $this->LvgesamtnoteModel->load($id->retval);
if(hasData($res)) $lvgesamtnote = getData($res)[0]; if(hasData($res)) $lvgesamtnote = getData($res)[0];
} }
$this->logLib->logInfoDB(array('saveNotenvorschlagBulk insert lv gesamtnote',$res, getAuthUID(), getAuthPersonId()));
} }
$retLvNoten[] = $lvgesamtnote; $retLvNoten[] = $lvgesamtnote;
@@ -987,6 +1035,8 @@ class Noten extends FHCAPI_Controller
$ret[$student->uid] = $this->savePruefungstermin($typ, $student_uid, $lva_id, $stsem, $lehreinheit_id, $note, $punkte, $datum); $ret[$student->uid] = $this->savePruefungstermin($typ, $student_uid, $lva_id, $stsem, $lehreinheit_id, $note, $punkte, $datum);
} }
$this->logLib->logInfoDB(array('createPruefungen',$ret, getAuthUID(), getAuthPersonId()));
$this->terminateWithSuccess($ret); $this->terminateWithSuccess($ret);
} }
@@ -1010,15 +1060,23 @@ class Noten extends FHCAPI_Controller
$ret = []; $ret = [];
foreach ($pruefungen as $pruefung) { foreach ($pruefungen as $pruefung) {
if(defined(CIS_GESAMTNOTE_PUNKTE) && CIS_GESAMTNOTE_PUNKTE) {
$result = $this->NotenschluesselaufteilungModel->getNote($pruefung->punkte, $lv_id, $sem_kurzbz);
$pruefung->note = $this->getDataOrTerminateWithError($result);
}
$student_uid = $pruefung->uid; $student_uid = $pruefung->uid;
$typ = $pruefung->typ; $typ = $pruefung->typ;
$note = $pruefung->note; // TODO: parameterize for import maybe $note = $pruefung->note; // TODO: parameterize for import maybe
$datum = $pruefung->datum; $datum = $pruefung->datum;
$punkte = null; $punkte = $pruefung->punkte;
$lehreinheit_id = $pruefung->lehreinheit_id; $lehreinheit_id = $pruefung->lehreinheit_id;
$ret[$student_uid] = $this->savePruefungstermin($typ, $student_uid, $lv_id, $sem_kurzbz, $lehreinheit_id, $note, $punkte, $datum); $ret[$student_uid] = $this->savePruefungstermin($typ, $student_uid, $lv_id, $sem_kurzbz, $lehreinheit_id, $note, $punkte, $datum);
} }
$this->logLib->logInfoDB(array('savePruefungenBulk',$ret, getAuthUID(), getAuthPersonId()));
$this->terminateWithSuccess($ret); $this->terminateWithSuccess($ret);
} }
@@ -1051,8 +1109,7 @@ class Noten extends FHCAPI_Controller
public function getNoteByPunkte() { public function getNoteByPunkte() {
$result = $this->getPostJSON(); $result = $this->getPostJSON();
// TODO validate post properly
if(!property_exists($result, 'punkte') if(!property_exists($result, 'punkte')
|| !property_exists($result, 'lv_id') || !property_exists($result, 'lv_id')
|| !property_exists($result, 'sem_kurzbz')) { || !property_exists($result, 'sem_kurzbz')) {
@@ -260,7 +260,6 @@ export const Benotungstool = {
// in case we need to further validate noten, currently parser does all // in case we need to further validate noten, currently parser does all
}, },
parseNote(rowParts, notenbulk, rowNum) { parseNote(rowParts, notenbulk, rowNum) {
debugger
const id = this.identifyUid(rowParts[0]) const id = this.identifyUid(rowParts[0])
const idTrimmed = rowParts[0].trim() const idTrimmed = rowParts[0].trim()
let student = null let student = null
@@ -271,36 +270,47 @@ export const Benotungstool = {
student = this.studenten.find(s => s.uid?.trim() === idTrimmed) student = this.studenten.find(s => s.uid?.trim() === idTrimmed)
} }
if(!student) { if(!student) {
// TODO: phrase
this.$fhcAlert.alertWarning('Kein Student gefunden für ID ' + rowParts[0] + ' in Zeile Nr. ' + rowNum + ' Die Zeile wurde übersprungen.') this.$fhcAlert.alertWarning('Kein Student gefunden für ID ' + rowParts[0] + ' in Zeile Nr. ' + rowNum + ' Die Zeile wurde übersprungen.')
return return
} }
const note = rowParts[1] let punkte = null
let note = null
if(this.config?.CIS_GESAMTNOTE_PUNKTE) {
punkte = Number.parseFloat(rowParts[1])
} else {
note = rowParts[1]
// find notenoption and check if its allowed to use in lehre // find notenoption and check if its allowed to use in lehre
const notenOption = this.notenOptions.find(n => n.note == note) const notenOption = this.notenOptions.find(n => n.note == note)
if(!notenOption.lehre) { if(!notenOption.lehre) {
this.$fhcAlert.alertWarning('Keine gültige Note gefunden für ID ' + rowParts[0] + ' in Zeile Nr. ' + rowNum + ' Die Zeile wurde übersprungen.') // TODO: phrasen
return this.$fhcAlert.alertWarning('Keine gültige Note gefunden für ID ' + rowParts[0] + ' in Zeile Nr. ' + rowNum + ' Die Zeile wurde übersprungen.')
return
}
} }
notenbulk.push({uid: student.uid, note}) notenbulk.push({uid: student.uid, note, punkte})
}, },
parsePruefung(rowParts, pruefungbulk, rowNum) { parsePruefung(rowParts, pruefungbulk, rowNum) {
const id = this.identifyUid(rowParts[0]) const id = this.identifyUid(rowParts[0])
const idTrimmed = rowParts[0].trim()
let student = null let student = null
if(id === 'matrikelnr') { // find student by matrnr and use uid later on if(id === 'matrikelnr') { // find student by matrnr and use uid later on
student = this.studenten.find(s => s.matrikelnr === rowParts[0]) student = this.studenten.find(s => s.matrikelnr?.trim() === idTrimmed)
} else if(id === 'uid') { } else if(id === 'uid') {
student = this.studenten.find(s => s.uid === rowParts[0]) student = this.studenten.find(s => s.uid?.trim() === idTrimmed)
} }
if(!student) { if(!student) {
// TODO: phrase
this.$fhcAlert.alertWarning('Kein Student gefunden für ID ' + rowParts[0] + ' in Zeile Nr. ' + rowNum + ' Die Zeile wurde übersprungen.') this.$fhcAlert.alertWarning('Kein Student gefunden für ID ' + rowParts[0] + ' in Zeile Nr. ' + rowNum + ' Die Zeile wurde übersprungen.')
return return
} }
const datum = rowParts[1] // should be in 'dd.MM.yyyy' const datum = rowParts[1] // should be in 'dd.MM.yyyy'
if(!this.isValidDate_ddmmyyyy(datum)) { if(!this.isValidDate_ddmmyyyy(datum)) {
// TODO: phrase
this.$fhcAlert.alertWarning('Ungültiges Datumformat für ID ' + rowParts[0] + ' in Zeile Nr. ' + rowNum + '. Bitte verwenden Sie das Format "DD.MM.YYYY". Die Zeile wurde übersprungen.') this.$fhcAlert.alertWarning('Ungültiges Datumformat für ID ' + rowParts[0] + ' in Zeile Nr. ' + rowNum + '. Bitte verwenden Sie das Format "DD.MM.YYYY". Die Zeile wurde übersprungen.')
return return
} }
@@ -314,21 +324,27 @@ export const Benotungstool = {
let monthInt = parseInt(month, 10) let monthInt = parseInt(month, 10)
monthInt -= 1 monthInt -= 1
const dateObj = new Date(year, monthInt, day) const dateObj = new Date(year, monthInt, day)
const note = rowParts[2]
// find notenoption and check if its allowed to use in lehre
const notenOption = this.notenOptions.find(n => n.note == note)
if(!notenOption.lehre) {
this.$fhcAlert.alertWarning('Keine gültige Note gefunden für ID ' + rowParts[0] + ' in Zeile Nr. ' + rowNum + ' Die Zeile wurde übersprungen.')
return
}
let punkte = null
let note = null
if(this.config?.CIS_GESAMTNOTE_PUNKTE) {
punkte = Number.parseFloat(rowParts[1])
} else {
note = rowParts[1]
// find notenoption and check if its allowed to use in lehre
const notenOption = this.notenOptions.find(n => n.note == note)
if(!notenOption.lehre) {
// TODO: phrasen
this.$fhcAlert.alertWarning('Keine gültige Note gefunden für ID ' + rowParts[0] + ' in Zeile Nr. ' + rowNum + ' Die Zeile wurde übersprungen.')
return
}
}
const typ = this.getPruefungstypForStudentByAntritt(student) const typ = this.getPruefungstypForStudentByAntritt(student)
pruefungbulk.push({uid: student.uid, datum: dateStr, note, typ, lehreinheit_id: student.lehreinheit_id, dateObj}) pruefungbulk.push({uid: student.uid, datum: dateStr, note, punkte, typ, lehreinheit_id: student.lehreinheit_id, dateObj})
}, },
saveNotenBulk(notenbulk) { saveNotenBulk(notenbulk) {
this.loading = true this.loading = true
@@ -477,8 +493,6 @@ export const Benotungstool = {
} }
}) })
// TODO: punkte parsen!
// parsers check for notenOption.lehre === true and if student uid/matrikelnr matches // parsers check for notenOption.lehre === true and if student uid/matrikelnr matches
// pruefungen check for younger pruefungen, so there are no further antritte with // pruefungen check for younger pruefungen, so there are no further antritte with
@@ -514,6 +528,7 @@ export const Benotungstool = {
return arrsREqual return arrsREqual
}, },
getNotenTableOptions() { getNotenTableOptions() {
return { return {
// debugEventsExternal:true, // debugEventsExternal:true,
// debugEventsInternal:true, // debugEventsInternal:true,
@@ -527,17 +542,18 @@ export const Benotungstool = {
selectablePersistence: false, // reset selection on table reload selectablePersistence: false, // reset selection on table reload
selectableCheck: function(row, e){ selectableCheck: function(row, e){
const data = row.getData(); const data = row.getData();
if(data['kommPruef']) return false if(data['kommPruef']) return false
else if(data.hoechsterAntritt >= 3) return false // 3 pruefungen counted else if(data.hoechsterAntritt >= 3) return false // 3 pruefungen counted
return true; // student can be selected to add pruefung return true; // student can be selected to add pruefung
}, },
rowHeight: 40, rowHeight: 40,
rowFormatter: this.fixTabulatorSelectionFormatter, rowFormatter: this.fixTabulatorSelectionFormatter,
columns: this.getColumnsDefinition(), columns: this.getColumnsDefinition(),
persistence: false, persistence: false,
} }
}, },
getColumnsDefinition() { getColumnsDefinition() {
const columns = [] const columns = []
@@ -1,4 +1,5 @@
import ApiLehre from "../../api/factory/lehre.js"; import ApiLehre from "../../api/factory/lehre.js";
import {capitalize} from "../../helpers/StringHelpers.js";
const options = Vue.ref([]); const options = Vue.ref([]);
const params = Vue.ref({}); const params = Vue.ref({});
@@ -63,7 +64,7 @@ async function fetchLehreinheiten(lv_id, sem_kurzbz) {
const LehreinheitenModule = Vue.reactive({ const LehreinheitenModule = Vue.reactive({
options, options,
optionLabel: 'infoString', optionLabel: 'infoString',
placeholder: Vue.computed(()=>appContext?.$p.t('lehre/lehreinheit')), placeholder: capitalize(Vue.computed(()=>appContext?.$p.t('lehre/lehreinheit'))),
setupContext, setupContext,
bindParams bindParams
}); });
+18 -1
View File
@@ -1,4 +1,21 @@
export function capitalize(string) { export function capitalize(string) {
if (!string) return ''; if (!string) return '';
return string[0].toUpperCase() + string.slice(1);
if (Vue.isRef(string)) {
console.log('Vue.isRef(string)', string)
return Vue.computed(() => {
const val = Vue.unref(string);
return (val && typeof val === 'string') ? val.charAt(0).toUpperCase() + val.slice(1) : '';
});
}
// just a plain string, return a plain string
if (typeof string === 'string') {
console.log('if (typeof string === \'string\') {', string)
return string.charAt(0).toUpperCase() + string.slice(1);
}
return '';
} }