Mailversand und Logeinträge

This commit is contained in:
ma0068
2023-10-11 16:21:09 +02:00
parent 66af9531b7
commit 4a56d45a07
3 changed files with 130 additions and 140 deletions
@@ -72,53 +72,46 @@ class Projektarbeit_model extends DB_Model
return $this->execQuery($qry, $params);
}
public function getMissedProjektarbeiten()
/**
* Gets all Projektarbeiten not uploaded in Time
* @param String $startDate project works before this date will be ignored (in Dateformat: 'YYYY'-'mm'-'dd')
* @return object
*/
public function getAllProjektarbeitenNotUploadedInTime($startDate = null)
{
//TODO(MANU) check values
$allowedProjekttypes = array();
$allowedProjekttypes[] = 'Bachelor';
$allowedProjekttypes[] = 'Diplom';
$selectedStg = [331, 328];
$allowedProjekttypes = ['Bachelor', 'Diplom'];
$now = new DateTime();
$this->db->distinct();
$this->addSelect($this->dbTable.'.projektarbeit_id');
$this->addSelect($this->dbTable.'.titel');
$this->addSelect($this->dbTable.'.student_uid');
$this->addSelect($this->dbTable.'.note');
$this->addSelect($this->dbTable.'.seitenanzahl');
$this->addSelect('p' . '.person_id');
$this->addSelect('le' . '.lehreinheit_id');
$this->addSelect('sg' . '.studiengang_kz');
$this->addJoin('campus.tbl_paabgabe pa','projektarbeit_id');
$this->addJoin('public.tbl_benutzer ben','ben.uid = tbl_projektarbeit.student_uid');
$this->addJoin('public.tbl_person p', 'person_id', 'LEFT');
$this->addJoin('campus.tbl_paabgabe pa', 'projektarbeit_id');
$this->addJoin('lehre.tbl_projektbetreuer pb', 'projektarbeit_id');
$this->addJoin('public.tbl_benutzer ben', 'ben.uid = tbl_projektarbeit.student_uid');
$this->addJoin('public.tbl_person p', 'p.person_id = ben.person_id', 'LEFT');
$this->addJoin('lehre.tbl_lehreinheit le', 'lehreinheit_id', 'LEFT');
$this->addJoin('lehre.tbl_lehrveranstaltung lv', 'lehrveranstaltung_id', 'LEFT');
$this->addJoin('public.tbl_studiengang sg', 'studiengang_kz', 'LEFT');
$this->db->where('pa.paabgabetyp_kurzbz', 'end');
$this->db->where_in($this->dbTable. '.projekttyp_kurzbz', $allowedProjekttypes);
//TODO(MANU) Config date
$this->db->where('pa.datum >', '2022-09-01');
$this->db->where('pa.abgabedatum', NULL);
if($startDate)
$this->db->where('pa.datum >', $startDate);
//TODO(MANU) get date with NOW
$this->db->where('pa.datum < ', '2023-10-10');
//TODO(MANU) check if note null: ausreichend?
$this->db->where($this->dbTable. '.note', NULL);
$this->db->where_in('sg.studiengang_kz', $selectedStg);
//$this->addLimit(3); //for testing
$this->db->where($this->dbTable. '.note', null); //TODO(MANU) check if note null: ausreichend?
return $this->loadWhere([
'pa.fixtermin' => 'TRUE'
'pa.fixtermin' => 'true',
'pa.paabgabetyp_kurzbz' => 'end',
'pa.abgabedatum' => null,
'pa.datum < ' => $now->format('c'),
'pb.betreuerart_kurzbz' => 'Erstbegutachter'
]);
}
}