mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Notenfreigabe email template insert in dbupdate3.4; notenvorschlag übernehmen cellHandler adjustment; WIP testing pruefungen & pruefungs config
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
if (! defined('DB_NAME')) exit('No direct script access allowed');
|
||||
|
||||
if($result = $db->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 '<strong>system.tbl_vorlage: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo "<br>system.tbl_vorlage Notenfreigabe hinzugefuegt";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user