mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Insert Note 7 in Projektarbeite, Projektarbeit kopieren
This commit is contained in:
@@ -48,16 +48,120 @@ class ProjektarbeitJob extends JOB_Controller
|
||||
|
||||
//get all missed Projektarbeiten
|
||||
$result = $this->ProjektarbeitModel->getMissedProjektarbeiten();
|
||||
/* if(isError($result))
|
||||
return $this->logError(getError($result));
|
||||
/* if(isError($result))
|
||||
return $this->logError(getError($result));
|
||||
|
||||
if(!hasData($result))
|
||||
return $this->logInfo('End Job Projektarbeit Update: 0 Mails sent');
|
||||
*/
|
||||
if(isError($result))
|
||||
echo $nl . $result;
|
||||
|
||||
if(!hasData($result))
|
||||
return $this->logInfo('End Job sendStglSammelmail: 0 Mails sent');
|
||||
*/
|
||||
echo $nl . 'End Job Projektarbeit Update: 0 Mails sent';
|
||||
|
||||
|
||||
$projektarbeiten = getData($result);
|
||||
var_dump($projektarbeiten);
|
||||
|
||||
//note auf 7 setzen
|
||||
foreach ($projektarbeiten as $projekt) {
|
||||
|
||||
$this->db->where('projektarbeit_id', $projekt->projektarbeit_id);
|
||||
|
||||
$result = $this->ProjektarbeitModel->update([
|
||||
'projektarbeit_id' => $projekt->projektarbeit_id
|
||||
], [
|
||||
'note' => 7
|
||||
]);
|
||||
|
||||
if (isError($result))
|
||||
echo "error: " . getError($result);
|
||||
else
|
||||
echo $nl . " erfolgreiches update von projektarbeit_id " . $projekt->projektarbeit_id;
|
||||
|
||||
//copy Projektarbeit
|
||||
$result = $this->ProjektarbeitModel->load($projekt->projektarbeit_id);
|
||||
if (isError($result))
|
||||
{
|
||||
echo "error: " . getError($result);
|
||||
continue;
|
||||
}
|
||||
if(!hasData($result))
|
||||
{
|
||||
echo $nl . 'Keine Projektarbeit für projektarbeit_id ' . $projekt->projektarbeit_id . 'gefunden';
|
||||
continue;
|
||||
}
|
||||
$projektarbeit = getData($result)[0];
|
||||
var_dump($projektarbeit);
|
||||
|
||||
$result = $this->ProjektarbeitModel->insert([
|
||||
'projekttyp_kurzbz' => $projektarbeit->projekttyp_kurzbz,
|
||||
'titel' => $projektarbeit->titel,
|
||||
'insertvon' => 'Projektjob',
|
||||
'note' => NULL,
|
||||
'lehreinheit_id' => $projektarbeit->lehreinheit_id,
|
||||
'student_uid' => $projektarbeit->student_uid
|
||||
|
||||
]);
|
||||
if (isError($result))
|
||||
echo "error: " . getError($result);
|
||||
|
||||
//Betreuungen kopieren
|
||||
|
||||
//get bestehende Betreuungen
|
||||
$result = $this->ProjektbetreuerModel->loadWhere([
|
||||
'projektarbeit_id' => $projekt->projektarbeit_id,
|
||||
//'betreuerart_kurzbz' => $projekt->betreuerart_kurzbz
|
||||
]);
|
||||
if (isError($result))
|
||||
//$this->logError(getError($result));
|
||||
echo "error: " . getError($result);
|
||||
elseif (!hasData($result))
|
||||
{
|
||||
echo $nl . 'Keine Projektarbeit für' . $projekt->projektarbeit_id . 'gefunden';
|
||||
}
|
||||
else
|
||||
{
|
||||
$betreuung = getData($result);
|
||||
var_dump($betreuung);
|
||||
|
||||
foreach($betreuung as $bet)
|
||||
{
|
||||
echo $nl . $bet->person_id . " " . $bet->projektarbeit_id . " Art: " . $bet->betreuerart_kurzbz;
|
||||
}
|
||||
|
||||
//var_dump($projektarbeit_copy);
|
||||
//$projekt_id_copy = $projektarbeit_copy->projektarbeit_id;
|
||||
//echo "Projektarbeit alt " . $projekt->projektarbeit_id . " Projektarbeit neu: " . $projekt_id_copy;
|
||||
}
|
||||
|
||||
|
||||
$result = $this->ProjektarbeitModel->loadWhere([
|
||||
'student_uid' => $projektarbeit->student_uid,
|
||||
'insertvon' => 'Projektjob',
|
||||
'note' => NULL
|
||||
]);
|
||||
if (isError($result))
|
||||
//$this->logError(getError($result));
|
||||
echo "error: " . getError($result);
|
||||
elseif (!hasData($result))
|
||||
{
|
||||
echo $nl . 'Keine neu angelegte projektarbeit_id für StudentId' . $projektarbeit->student_uid . 'gefunden';
|
||||
}
|
||||
else
|
||||
{
|
||||
$projektarbeit_copy = getData($result)[0];
|
||||
//var_dump($projektarbeit_copy);
|
||||
$projekt_id_copy = $projektarbeit_copy->projektarbeit_id;
|
||||
echo $nl . "Projektarbeit alt " . $projekt->projektarbeit_id . " Projektarbeit neu: " . $projekt_id_copy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ class Projektarbeit_model extends DB_Model
|
||||
parent::__construct();
|
||||
$this->dbTable = 'lehre.tbl_projektarbeit';
|
||||
$this->pk = 'projektarbeit_id';
|
||||
|
||||
$this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,8 +81,6 @@ class Projektarbeit_model extends DB_Model
|
||||
|
||||
$now = new DateTime();
|
||||
|
||||
|
||||
//$this->addSelect($this->dbTable.'.*');
|
||||
$this->addSelect($this->dbTable.'.projektarbeit_id');
|
||||
$this->addSelect($this->dbTable.'.titel');
|
||||
$this->addSelect($this->dbTable.'.student_uid');
|
||||
@@ -104,10 +104,14 @@ class Projektarbeit_model extends DB_Model
|
||||
$this->db->where('pa.datum >', '2022-09-01');
|
||||
//$this->db->where('pa.fixtermin', 'TRUE');
|
||||
$this->db->where('pa.abgabedatum', NULL);
|
||||
|
||||
//TODO(MANU) get date with NOW
|
||||
$this->db->where('pa.datum < ', '2023-10-04');
|
||||
|
||||
$this->addLimit(10);
|
||||
//TODO(MANU) check if note null: ausreichend?
|
||||
$this->db->where($this->dbTable. '.note', NULL);
|
||||
|
||||
$this->addLimit(1);
|
||||
|
||||
return $this->loadWhere([
|
||||
'pa.fixtermin' => 'TRUE',
|
||||
|
||||
Reference in New Issue
Block a user