mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 16:32:20 +00:00
issues table dataset:
- made more readable for assistance (added vorname, nachname, removed some fields) - added default filters (all new, last 7 days...) - issues displayed for children oes of permitted arrays as well - query: more exact check for prestudents future status by using studiensemester start date - typo fixes
This commit is contained in:
@@ -10,27 +10,29 @@ $query = "SELECT issue_id, fehlercode AS \"Fehlercode\", iss.fehlercode_extern A
|
||||
inhalt AS \"Inhalt\", inhalt_extern AS \"Inhalt extern\", iss.person_id AS \"PersonId\", iss.oe_kurzbz AS \"OE\",
|
||||
ftyp.bezeichnung_mehrsprachig[1] AS \"Fehlertyp\", stat.bezeichnung_mehrsprachig[1] AS \"Fehlerstatus\",
|
||||
verarbeitetvon AS \"Verarbeitet von\",verarbeitetamum AS \"Verarbeitet am\", fr.app AS \"Applikation\",
|
||||
fr.fehlertyp_kurzbz as \"Fehlertypcode\", iss.status_kurzbz AS \"Statuscode\"
|
||||
fr.fehlertyp_kurzbz as \"Fehlertypcode\", iss.status_kurzbz AS \"Statuscode\",
|
||||
pers.vorname AS \"Vorname\", pers.nachname AS \"Nachname\"
|
||||
FROM system.tbl_issue iss
|
||||
JOIN system.tbl_fehler fr USING (fehlercode)
|
||||
JOIN system.tbl_fehlertyp ftyp USING (fehlertyp_kurzbz)
|
||||
JOIN system.tbl_issue_status stat USING (status_kurzbz)
|
||||
LEFT JOIN public.tbl_person pers ON iss.person_id = pers.person_id
|
||||
WHERE EXISTS (
|
||||
SELECT 1 FROM system.tbl_fehler_zustaendigkeiten
|
||||
SELECT 1 FROM system.tbl_fehler_zustaendigkeiten zst
|
||||
WHERE fehlercode = iss.fehlercode
|
||||
AND (
|
||||
person_id = ".$PERSON_ID." /* person_id in fehler_zustaendigkeit for individual persons */";
|
||||
|
||||
if (!isEmptyArray($all_oe_kurzbz_with_funktionen))
|
||||
{
|
||||
$query .= " OR (oe_kurzbz IN $ALL_OE_KURZBZ AND funktion_kurzbz IS NULL) /* if oe is specified in fehler_zustaendigkeiten */";
|
||||
$query .= " OR (zst.oe_kurzbz IN $ALL_OE_KURZBZ AND zst.funktion_kurzbz IS NULL) /* if oe is specified in fehler_zustaendigkeiten */";
|
||||
|
||||
// check for each oe for each function if zustaendig
|
||||
foreach ($all_oe_kurzbz_with_funktionen as $oe_kurzbz => $funktionen_kurzbz)
|
||||
{
|
||||
foreach ($funktionen_kurzbz as $funktion_kurzbz)
|
||||
{
|
||||
$query .= " OR (oe_kurzbz = '$oe_kurzbz' AND funktion_kurzbz = '$funktion_kurzbz')";
|
||||
$query .= " OR (zst.oe_kurzbz = '$oe_kurzbz' AND zst.funktion_kurzbz = '$funktion_kurzbz')";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,9 +42,9 @@ $query .= "))"; // close AND of exists, and exists
|
||||
// show issue if it is assigend to oe of uid or to student of oe of uid
|
||||
if (!isEmptyArray($all_oe_kurzbz_berechtigt))
|
||||
{
|
||||
$query .= " OR oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT /* if error is for studiengang oe */";
|
||||
$query .= " OR iss.oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT /* if error is for studiengang oe */";
|
||||
|
||||
$query .= " OR (oe_kurzbz IS NULL AND EXISTS ( /* if person_id of error is a student of studiengang oe */
|
||||
$query .= " OR (iss.oe_kurzbz IS NULL AND EXISTS ( /* if person_id of error is a student of studiengang oe */
|
||||
SELECT 1 FROM public.tbl_prestudent ps
|
||||
JOIN public.tbl_prestudentstatus pss USING (prestudent_id)
|
||||
JOIN public.tbl_studiengang stg USING (studiengang_kz)
|
||||
@@ -51,15 +53,17 @@ if (!isEmptyArray($all_oe_kurzbz_berechtigt))
|
||||
AND pss.status_kurzbz IN $RELEVANT_PRESTUDENT_STATUS
|
||||
AND NOT EXISTS (SELECT 1
|
||||
FROM public.tbl_prestudentstatus ps_finished
|
||||
JOIN public.tbl_studiensemester sem_finished USING (studiensemester_kurzbz)
|
||||
WHERE prestudent_id = ps.prestudent_id /* irrelevant if already finished studies and studied a while ago */
|
||||
AND status_kurzbz IN ('Absolvent','Abbrecher','Abgewiesener')
|
||||
AND datum::date + interval '2 months' < NOW()
|
||||
AND EXISTS (SELECT 1 FROM public.tbl_prestudent /* if more recent prestudent exists, their oe should get the issue */
|
||||
JOIN public.tbl_prestudentstatus USING (prestudent_id)
|
||||
JOIN public.tbl_studiensemester USING (studiensemester_kurzbz)
|
||||
WHERE tbl_prestudentstatus.status_kurzbz IN $RELEVANT_PRESTUDENT_STATUS
|
||||
AND person_id = ps.person_id
|
||||
AND prestudent_id <> ps_finished.prestudent_id
|
||||
AND datum::date >= ps_finished.datum::date)
|
||||
AND tbl_studiensemester.start::date > sem_finished.start::date)
|
||||
)
|
||||
)
|
||||
)";
|
||||
@@ -69,7 +73,13 @@ $query .= " ORDER BY CASE
|
||||
WHEN iss.status_kurzbz = '".IssuesLib::STATUS_NEU."' THEN 0
|
||||
WHEN iss.status_kurzbz = '".IssuesLib::STATUS_IN_BEARBEITUNG."' THEN 1
|
||||
ELSE 2
|
||||
END, datum DESC, fehlercode, issue_id DESC";
|
||||
END,
|
||||
CASE
|
||||
WHEN fehlertyp_kurzbz = '".IssuesLib::ERRORTYPE_CODE."' THEN 0
|
||||
WHEN fehlertyp_kurzbz = '".IssuesLib::WARNINGTYPE_CODE."' THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
datum DESC, fehlercode, issue_id DESC";
|
||||
|
||||
$filterWidgetArray = array(
|
||||
'query' => $query,
|
||||
@@ -96,6 +106,8 @@ $filterWidgetArray = array(
|
||||
'Applikation',
|
||||
'Fehlertypcode',
|
||||
'Statuscode',
|
||||
'Vorname',
|
||||
'Nachname'
|
||||
),
|
||||
'formatRow' => function($datasetRaw) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user