diff --git a/application/controllers/api/frontend/v1/Noten.php b/application/controllers/api/frontend/v1/Noten.php index 125b3e0bc..4e19aa27e 100644 --- a/application/controllers/api/frontend/v1/Noten.php +++ b/application/controllers/api/frontend/v1/Noten.php @@ -529,11 +529,11 @@ class Noten extends FHCAPI_Controller if(isset($punkte) && $punkte >= 0) { // Bei Punkteeingabe wird die Note nochmals geprueft und ggf korrigiert - $result = $this->NotenschluesselaufteilungModel->getNote($punkte, $lva_id, $stsem); - if(isError($result)) { - $this->terminateWithError('Notenspiegel Error'); + $resultNote = $this->NotenschluesselaufteilungModel->getNote($punkte, $lva_id, $stsem); + if(isError($resultNote)) { + $this->terminateWithError(getError($resultNote)); } else { - $data = getData($result); + $data = getData($resultNote); if($data != $note) { $note = $data; @@ -865,10 +865,9 @@ class Noten extends FHCAPI_Controller $note = $result->note; $punkte = $result->punkte; - - $result = $this->LvgesamtnoteModel->getLvGesamtNoten($lv_id, $student_uid, $sem_kurzbz); - + $this->addMeta('LvgesamtnoteModelresult', $result); + if(!isError($result) && hasData($result)) { $lvgesamtnote = getData($result)[0]; @@ -933,7 +932,6 @@ class Noten extends FHCAPI_Controller $this->terminateWithError($this->p->t('global', 'missingParameters'), 'general'); } - $lv_id = $result->lv_id; $sem_kurzbz = $result->sem_kurzbz; $noten = $result->noten; @@ -944,10 +942,12 @@ class Noten extends FHCAPI_Controller { $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); + $this->addMeta($note->uid.'$result', $result); + + if(CIS_GESAMTNOTE_PUNKTE) { + $resultNote = $this->NotenschluesselaufteilungModel->getNote($note->punkte, $lv_id, $sem_kurzbz); + $note->note = $this->getDataOrTerminateWithError($resultNote); + $this->addMeta($note->uid.'note', $note); } if(!isError($result) && hasData($result)) { @@ -1061,9 +1061,11 @@ class Noten extends FHCAPI_Controller foreach ($pruefungen as $pruefung) { - if(defined(CIS_GESAMTNOTE_PUNKTE) && CIS_GESAMTNOTE_PUNKTE) { + if(CIS_GESAMTNOTE_PUNKTE) { $result = $this->NotenschluesselaufteilungModel->getNote($pruefung->punkte, $lv_id, $sem_kurzbz); + $this->addMeta($pruefung->uid."result", $result); $pruefung->note = $this->getDataOrTerminateWithError($result); + $this->addMeta($pruefung->uid."note", $pruefung->note); } $student_uid = $pruefung->uid; diff --git a/application/models/education/Lvgesamtnote_model.php b/application/models/education/Lvgesamtnote_model.php index c30045ff0..b71eb1bb6 100644 --- a/application/models/education/Lvgesamtnote_model.php +++ b/application/models/education/Lvgesamtnote_model.php @@ -14,7 +14,7 @@ class Lvgesamtnote_model extends DB_Model } /** - * Laedt die Noten + * Laedt die Noten - lvgesamtnote (Vorschlag) JOIN tbl.note (zeugnisnote) * * @param integer $lehrveranstaltung_id * @param string $student_uid @@ -46,4 +46,21 @@ class Lvgesamtnote_model extends DB_Model return $this->loadWhere($where); } + +// public function getLvGesamtNoteVorschlag($lehrveranstaltung_id, $student_uid, $studiensemester_kurzbz) +// { +// $qry = "SELECT * FROM campus.tbl_lvgesamtnote +// WHERE campus.tbl_lvgesamtnote.student_uid = ? +// AND campus.tbl_lvgesamtnote.studiensemester_kurzbz = ?"; +// +// $where = []; +// if ($studiensemester_kurzbz) +// $where[$this->dbTable . ".studiensemester_kurzbz"] = $studiensemester_kurzbz; +// if ($lehrveranstaltung_id) +// $where[$this->dbTable . ".lehrveranstaltung_id"] = $lehrveranstaltung_id; +// if ($student_uid) +// $where[$this->dbTable . ".student_uid"] = $student_uid; +// +// return $this->loadWhere($where); +// } } diff --git a/application/models/education/Notenschluesselaufteilung_model.php b/application/models/education/Notenschluesselaufteilung_model.php index d48e16b0b..f9031de47 100644 --- a/application/models/education/Notenschluesselaufteilung_model.php +++ b/application/models/education/Notenschluesselaufteilung_model.php @@ -26,6 +26,9 @@ class Notenschluesselaufteilung_model extends DB_Model $this->load->model('education/Notenschluesselzuordnung_model', 'NotenschluesselzuordnungModel'); $notenschluessel_kurzbz = $this->NotenschluesselzuordnungModel->getKurzbzForLv($lehrveranstaltung_id, $studiensemester_kurzbz); + if($notenschluessel_kurzbz == null) + return success(null); + $this->addSelect("note"); $this->addOrder("punkte", "DESC"); $this->addLimit(1); diff --git a/public/js/components/Cis/Benotungstool/Benotungstool.js b/public/js/components/Cis/Benotungstool/Benotungstool.js index ca79737e0..343cef39d 100644 --- a/public/js/components/Cis/Benotungstool/Benotungstool.js +++ b/public/js/components/Cis/Benotungstool/Benotungstool.js @@ -182,6 +182,7 @@ export const Benotungstool = { this.$api.call(ApiNoten.getNoteByPunkte(value, this.lv_id, this.sem_kurzbz)).then(res => { if(res?.meta?.status === 'success' && res.data >= 0) { row.update({note_vorschlag: res.data}) + row.reformat() } }) }, @@ -365,6 +366,9 @@ export const Benotungstool = { s.note_vorschlag = lvn.note // TODO: check if note_vorschlag should be changed by import s.lv_note = lvn.note + if(this.config?.CIS_GESAMTNOTE_PUNKTE) { + s.punkte = lvn.punkte + } this.teilnoten[s.uid].note_lv = lvn.note // recalculate freigabestatus @@ -668,7 +672,7 @@ export const Benotungstool = { widthGrow: 1 }) columns.push({title: Vue.computed(() => this.$capitalize(this.$p.t('benotungstool/c4vorschlag_übernehmen'))), field: 'übernehmen', width: 150, hozAlign: 'center', formatter: this.arrowFormatter, - // cellClick: this.saveNote, + cellClick: this.saveNote, variableHeight: true}) columns.push({title: Vue.computed(() => this.$capitalize(this.$p.t('benotungstool/c4lvnote'))), field: 'lv_note', formatter: this.notenFormatter, @@ -1067,7 +1071,7 @@ export const Benotungstool = { button.className = 'btn btn-outline-secondary'; button.textContent = this.$capitalize(this.$p.t('benotungstool/c4notenvorschlagUebernehmen')); button.addEventListener('click', () => { - this.saveNote(data) + // this.saveNote(data) console.log('button click') }); return button; diff --git a/public/js/helpers/StringHelpers.js b/public/js/helpers/StringHelpers.js index 4b3686ca6..16f8c3dbf 100644 --- a/public/js/helpers/StringHelpers.js +++ b/public/js/helpers/StringHelpers.js @@ -1,9 +1,8 @@ export function capitalize(string) { if (!string) return ''; + // ref unwrap if we receive such 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) : ''; @@ -12,7 +11,6 @@ export function capitalize(string) { // 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); }