From 3a9704563f5c9850863410da41d498169736bb28 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 22 Apr 2021 15:52:46 +0200 Subject: [PATCH] Adapted JOB sendMailToSTGL to send mail only if Anrechnung not already processed Job gets all yesterdays Anrechnungen, that did not process further than first status. (If Anrechnung is new, but STGL already started the process yesterday, he does not need to be informed about this new Anrechnung anymore) Signed-off-by: cris-technikum --- application/controllers/jobs/AnrechnungJob.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/controllers/jobs/AnrechnungJob.php b/application/controllers/jobs/AnrechnungJob.php index 39a22943e..9e5f1a213 100644 --- a/application/controllers/jobs/AnrechnungJob.php +++ b/application/controllers/jobs/AnrechnungJob.php @@ -100,7 +100,9 @@ class AnrechnungJob extends JOB_Controller { $this->logInfo('Start AnrechnungJob to send emails to STGL about yesterdays new Anrechnungen.'); - // Get all yesterdays Anrechnungen + // Get all yesterdays Anrechnungen, that did not process further than first status + // (If Anrechnung is new, but STGL already started the process yesterday, + // he does not need to be informed about this new Anrechnung anymore) $this->AnrechnungModel->addSelect('anrechnung_id, studiensemester_kurzbz, lv.studiengang_kz, lv.bezeichnung, vorname, nachname'); $this->AnrechnungModel->addJoin('lehre.tbl_lehrveranstaltung lv', 'lehrveranstaltung_id'); $this->AnrechnungModel->addJoin('public.tbl_student student', 'prestudent_id'); @@ -109,7 +111,8 @@ class AnrechnungJob extends JOB_Controller $this->AnrechnungModel->addOrder('lv.studiengang_kz, lv.bezeichnung'); $result = $this->AnrechnungModel->loadWhere( - '(lehre.tbl_anrechnung.insertamum)::date = (NOW() - INTERVAL \'24 HOURS\')::DATE' + '(lehre.tbl_anrechnung.insertamum)::date = (NOW() - INTERVAL \'24 HOURS\')::DATE + AND 1 = (SELECT COUNT(*) FROM lehre.tbl_anrechnung_anrechnungstatus status WHERE status.anrechnung_id = tbl_anrechnung.anrechnung_id)' ); // Exit if there are no Anrechnungen