diff --git a/application/controllers/api/frontend/v1/Noten.php b/application/controllers/api/frontend/v1/Noten.php
index 4e19aa27e..13f63a689 100644
--- a/application/controllers/api/frontend/v1/Noten.php
+++ b/application/controllers/api/frontend/v1/Noten.php
@@ -174,12 +174,9 @@ class Noten extends FHCAPI_Controller
foreach($student_uids as $uid) {
$grades[$uid]['grades'] = [];
-
-// $res = $this->StudentModel->load([$uid]);
-// if(!isError($res) && hasData($res)) $student = getData($res)[0];
-
- $result = $this->LvgesamtnoteModel->getLvGesamtNoten($lv_id, $uid, $sem_kurzbz);
+ $result = $this->LvgesamtnoteModel->getLvGesamtNoten($lv_id, $uid, $sem_kurzbz);
+ $this->addMeta($uid.'getLvGesamtNoten', $result);
if(!isError($result) && hasData($result)) {
$lvgesamtnote = getData($result)[0];
$grades[$uid]['note_lv'] = $lvgesamtnote->note;
@@ -367,8 +364,8 @@ class Noten extends FHCAPI_Controller
foreach($result->noten as $note) {
- $resultLVGes = $this->LvgesamtnoteModel->getLvGesamtNoten($lv_id, $note->uid, $sem_kurzbz);
-
+ $resultLVGes = $this->LvgesamtnoteModel->getLvGesamtNoteVorschlag($lv_id, $note->uid, $sem_kurzbz);
+ $this->addMeta($note->uid.'$resultLVGes', $resultLVGes);
if (!isError($resultLVGes) && hasData($resultLVGes))
{
$lvgesamtnote = getData($resultLVGes)[0];
@@ -379,7 +376,7 @@ class Noten extends FHCAPI_Controller
$id = $this->LvgesamtnoteModel->update(
[$lvgesamtnote->student_uid, $lvgesamtnote->studiensemester_kurzbz, $lvgesamtnote->lehrveranstaltung_id],
array(
- 'note' => $note->note,
+ 'note' => $lvgesamtnote->note,
'freigabevon_uid' => getAuthUID(),
'freigabedatum' => date("Y-m-d H:i:s"),
'updateamum' => date("Y-m-d H:i:s"),
@@ -483,15 +480,14 @@ class Noten extends FHCAPI_Controller
// TODO: we need a zuordnungscheck here? any lektor can get any grades?
// what about assistenz with different rights doing lectors job once again?
// students checking their own grades?
-
-
- $result = $this->LvgesamtnoteModel->getLvGesamtNoten($lv_id, $uid, $sem_kurzbz);
+
+ $result = $this->LvgesamtnoteModel->getLvGesamtNoteVorschlag($lv_id, $uid, $sem_kurzbz);
$data = $this->getDataOrTerminateWithError($result);
// TODO: moodle teilnote but it seems they only work for a whole course?
// get anw% of student by prestudent_id
- $anwresult = $this->getAnwesenheiten($prestudent_ids, $lv_id, $sem_kurzbz);
+// $anwresult = $this->getAnwesenheiten($prestudent_ids, $lv_id, $sem_kurzbz);
@@ -527,7 +523,7 @@ class Noten extends FHCAPI_Controller
$jetzt = date("Y-m-d H:i:s");
- if(isset($punkte) && $punkte >= 0) {
+ if(CIS_GESAMTNOTE_PUNKTE && isset($punkte) && $punkte >= 0) {
// Bei Punkteeingabe wird die Note nochmals geprueft und ggf korrigiert
$resultNote = $this->NotenschluesselaufteilungModel->getNote($punkte, $lva_id, $stsem);
if(isError($resultNote)) {
@@ -543,8 +539,12 @@ class Noten extends FHCAPI_Controller
}
// TODO: more sophisticated empty check
- if($note=='')
- $note = 9;
+ if($note=='') {
+ $this->load->model('education/Note_model', 'NoteModel');
+ $result = $this->NoteModel->getNochNichtEingetragenNote();
+ $note = getData($result)[0]->note;
+ }
+
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
@@ -560,8 +560,8 @@ class Noten extends FHCAPI_Controller
$this->terminateWithError('Kein gültiger Studiengang gefunden für ID: '.$studiengang_kz);
}
- //Gesamtnote updaten
- $result = $this->LvgesamtnoteModel->getLvGesamtNoten($lva_id, $student_uid, $stsem);
+
+ $result = $this->LvgesamtnoteModel->getLvGesamtNote($lva_id, $student_uid, $stsem);
if(!isError($result) && !hasData($result)) {
$id = $this->LvgesamtnoteModel->insert(
@@ -639,7 +639,6 @@ class Noten extends FHCAPI_Controller
// extra check if the student has lvnote and a zeugnisnote in the relevant lva
$resultLV = $this->LvgesamtnoteModel->getLvGesamtNoten($lva_id, $student_uid, $stsem);
-
$lvgesamtnoteData = getData($resultLV);
$this->addMeta('lvgesamtnoteData', $lvgesamtnoteData);
@@ -662,7 +661,9 @@ class Noten extends FHCAPI_Controller
);
if(count($status) > 0 && $status[0] == true) {
- $note = 17; //entschuldigt
+ $this->load->model('education/Note_model', 'NoteModel');
+ $result = $this->NoteModel->getEntschuldigtNote();
+ $note = getData($result)[0]->note;
}
$jetzt = date("Y-m-d H:i:s");
@@ -685,7 +686,7 @@ class Noten extends FHCAPI_Controller
} else if(!isError($result1) && !hasData($result1)) {
// new entry termin1
- $resultLV = $this->LvgesamtnoteModel->getLvGesamtNoten($lva_id, $student_uid, $stsem);
+ $resultLV = $this->LvgesamtnoteModel->getLvGesamtNoteVorschlag($lva_id, $student_uid, $stsem);
// update Termin1 note
if (hasData($resultLV))
@@ -697,8 +698,9 @@ class Noten extends FHCAPI_Controller
}
else if(!hasData($resultLV))// set Termin1 note to "noch nicht eingetragen"
{
- // TODO: avoid hardcoded noten primary keys!
- $pr_note = 9;
+ $this->load->model('education/Note_model', 'NoteModel');
+ $result = $this->NoteModel->getNochNichtEingetragenNote();
+ $pr_note = getData($result)[0]->note;
$pr_punkte = '';
$benotungsdatum = $jetzt;
}
@@ -864,8 +866,9 @@ class Noten extends FHCAPI_Controller
$sem_kurzbz = $result->sem_kurzbz;
$note = $result->note;
$punkte = $result->punkte;
+
+ $result = $this->LvgesamtnoteModel->getLvGesamtNoteVorschlag($lv_id, $student_uid, $sem_kurzbz);
- $result = $this->LvgesamtnoteModel->getLvGesamtNoten($lv_id, $student_uid, $sem_kurzbz);
$this->addMeta('LvgesamtnoteModelresult', $result);
if(!isError($result) && hasData($result)) {
@@ -941,7 +944,7 @@ class Noten extends FHCAPI_Controller
foreach($noten as $note)
{
- $result = $this->LvgesamtnoteModel->getLvGesamtNoten($lv_id, $note->uid, $sem_kurzbz);
+ $result = $this->LvgesamtnoteModel->getLvGesamtNoteVorschlag($lv_id, $note->uid, $sem_kurzbz);
$this->addMeta($note->uid.'$result', $result);
if(CIS_GESAMTNOTE_PUNKTE) {
@@ -1024,11 +1027,14 @@ class Noten extends FHCAPI_Controller
$stsem = $result->sem_kurzbz;
$ret = [];
+
+ $this->load->model('education/Note_model', 'NoteModel');
+ $result = $this->NoteModel->getNochNichtEingetragenNote();
+ $note = getData($result)[0]->note;
foreach ($uids as $student) {
$student_uid = $student->uid;
$typ = $student->typ;
- $note = 9; //$result->note; // TODO: parameterize for import maybe
$punkte = null; // new pruefungen never have punkte,
$lehreinheit_id = $student->lehreinheit_id;
diff --git a/application/models/education/Lvgesamtnote_model.php b/application/models/education/Lvgesamtnote_model.php
index b71eb1bb6..44645e75b 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 - lvgesamtnote (Vorschlag) JOIN tbl.note (zeugnisnote)
+ * Laedt die Noten - lvgesamtnote (Vorschlag) JOIN tbl.note (zeugnisnote)
*
* @param integer $lehrveranstaltung_id
* @param string $student_uid
@@ -47,20 +47,18 @@ 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);
-// }
+ 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 = ?";
+ $params = [$student_uid, $studiensemester_kurzbz];
+
+ if ($lehrveranstaltung_id) {
+ $qry .= "AND campus.tbl_lvgesamtnote.lehrveranstaltung_id = ?";
+ $params[] = $lehrveranstaltung_id;
+ }
+
+ return $this->execReadOnlyQuery($qry, $params);
+ }
}
diff --git a/application/models/education/Note_model.php b/application/models/education/Note_model.php
index 1265fb90d..e92bb8452 100644
--- a/application/models/education/Note_model.php
+++ b/application/models/education/Note_model.php
@@ -19,4 +19,25 @@ class Note_model extends DB_Model
return $this->execReadOnlyQuery($qry);
}
+
+ // used to determine the primary key of note "entschuldigt" to avoid hardcoded magic numbers
+ // that might differ in a different installation of fhcomplete
+ public function getEntschuldigtNote() {
+ $qry ="SELECT *
+ FROM lehre.tbl_note
+ WHERE bezeichnung = 'entschuldigt'";
+
+ return $this->execReadOnlyQuery($qry);
+ }
+
+ // used to determine the primary key of note "noch nicht eingetragen" to avoid hardcoded magic numbers
+ // that might differ in a different installation of fhcomplete
+ public function getNochNichtEingetragenNote() {
+ $qry ="SELECT *
+ FROM lehre.tbl_note
+ WHERE bezeichnung = 'Noch nicht eingetragen'";
+
+ return $this->execReadOnlyQuery($qry);
+ }
+
}
\ No newline at end of file
diff --git a/public/js/components/Cis/Benotungstool/Benotungstool.js b/public/js/components/Cis/Benotungstool/Benotungstool.js
index 343cef39d..e832f5a09 100644
--- a/public/js/components/Cis/Benotungstool/Benotungstool.js
+++ b/public/js/components/Cis/Benotungstool/Benotungstool.js
@@ -860,14 +860,16 @@ export const Benotungstool = {
return value
},
saveNote(e, cell) { // Notenvorschlag freigeben
- // TODO: rename & rework so it handles with a button
-
- // TODO: save this method once we decide the arrow was actually very cool
-
const row = cell.getRow()
const data = row.getData()
+
+
+
if(!data.note_vorschlag) return
+
+ // if vorschlag is the same as lv_note do nothing
+ if(data.note_vorschlag == data.lv_note) return
this.loading = true
this.$api.call(ApiNoten.saveNotenvorschlag(this.lv_id, this.sem_kurzbz, data.uid, data.note_vorschlag, data.punkte))
.then((res) => {
@@ -1070,10 +1072,6 @@ export const Benotungstool = {
const button = document.createElement('button');
button.className = 'btn btn-outline-secondary';
button.textContent = this.$capitalize(this.$p.t('benotungstool/c4notenvorschlagUebernehmen'));
- button.addEventListener('click', () => {
- // this.saveNote(data)
- console.log('button click')
- });
return button;
// // can save a notenvorschlag -> colored
@@ -1528,7 +1526,7 @@ export const Benotungstool = {
// set Cols
this.$refs.notenTable.tabulator.clearSort()
this.$refs.notenTable.tabulator.setColumns(cols)
-
+ this.$refs.notenTable.tabulator.redraw(true)
// redraw table outside this function
},
saveNoteneingabe() {
diff --git a/system/dbupdate_3.4/60873_gesamtnoteneingabe_cis4.php b/system/dbupdate_3.4/60873_gesamtnoteneingabe_cis4.php
new file mode 100644
index 000000000..4ae2e38d5
--- /dev/null
+++ b/system/dbupdate_3.4/60873_gesamtnoteneingabe_cis4.php
@@ -0,0 +1,17 @@
+db_query("SELECT 1 FROM public.tbl_vorlage WHERE vorlage_kurzbz = 'Notenfreigabe'"))
+{
+ if($db->db_num_rows($result) === 0)
+ {
+ $qry = "INSERT INTO public.tbl_vorlage (vorlage_kurzbz, bezeichnung, anmerkung, mimetype)
+ VALUES ('Notenfreigabe', 'Notenfreigabe', null, 'text/html')
+ ON CONFLICT (vorlage_kurzbz) DO NOTHING;";
+
+ if(!$db->db_query($qry))
+ echo 'system.tbl_vorlage: '.$db->db_last_error().'
';
+ else
+ echo "
system.tbl_vorlage Notenfreigabe hinzugefuegt";
+ }
+}
\ No newline at end of file