Browse Source

Bugfix TSG bei mehreren gleichzeitigen MSG #16

basisressourcen
Daniel Quathamer 8 months ago
parent
commit
2d9a04a796
  1. 28
      src-modules/module/costage/hilfstabellen/costage_st_studien_aggr_fuellen.sql

28
src-modules/module/costage/hilfstabellen/costage_st_studien_aggr_fuellen.sql

@ -264,8 +264,8 @@ drop table if exists tmp_tsg2msg;
select TSG.semester, select TSG.semester,
TSG.st_studstamm_nr, TSG.st_studstamm_nr,
TSG.st_studium_nr as st_studium_nr_tsg , TSG.st_studium_nr as st_studium_nr_tsg ,
MSG.primaerflag_studien as primaerflag_studien_msg, min(MSG.beginn_datum) as beginn_datum_msg,
MSG.beginn_datum as beginn_datum_msg, max(MSG.primaerflag_studien) as primaerflag_studien_msg,
count(distinct MSG.st_studium_nr) as anzahl_st_studium_nr_msg count(distinct MSG.st_studium_nr) as anzahl_st_studium_nr_msg
into temp tmp_tsg2msg into temp tmp_tsg2msg
from tmp_studien_esg_tsg TSG,tmp_studien_msg MSG, costage_st_studiengaenge_mtsg MTSG from tmp_studien_esg_tsg TSG,tmp_studien_msg MSG, costage_st_studiengaenge_mtsg MTSG
@ -275,7 +275,7 @@ and TSG.semester=MSG.semester
and TSG.st_studiengang_nr=MTSG.st_studiengang_nr_tsg and TSG.st_studiengang_nr=MTSG.st_studiengang_nr_tsg
and TSG.st_absz_nr=MSG.st_absz_nr and TSG.st_absz_nr=MSG.st_absz_nr
and MSG.st_studiengang_nr=MTSG.st_studiengang_nr_msg and MSG.st_studiengang_nr=MTSG.st_studiengang_nr_msg
group by 1,2,3,4,5 group by 1,2,3
; ;
--create index tmp_ix222 on tmp_tsg2msg(primaerflag_studien); --create index tmp_ix222 on tmp_tsg2msg(primaerflag_studien);
@ -479,6 +479,7 @@ T.studienfach_sortierung,
null::timestamp as beginn_datum, null::timestamp as beginn_datum,
null::timestamp AS gueltig_ab, null::timestamp AS gueltig_ab,
null::integer as st_studienstatus_nr, null::integer as st_studienstatus_nr,
null::integer as primaerflag_studien_msg,
max(T.semester) as letztes_tsg_semester, max(T.semester) as letztes_tsg_semester,
max(T.fachsemester) as fachsemester max(T.fachsemester) as fachsemester
into temp tmp_studien_msg_tsg_fehlend2 into temp tmp_studien_msg_tsg_fehlend2
@ -501,6 +502,15 @@ st_studienstatus_nr=S.st_studienstatus_nr
and S.st_studstamm_nr=tmp_studien_msg_tsg_fehlend2.st_studstamm_nr and S.st_studstamm_nr=tmp_studien_msg_tsg_fehlend2.st_studstamm_nr
and S.semester=tmp_studien_msg_tsg_fehlend2.letztes_tsg_semester and S.semester=tmp_studien_msg_tsg_fehlend2.letztes_tsg_semester
; ;
--Primärflag des MSG ermitteln, wichtig für die Ermittlung der Studiengang-Nr.
update tmp_studien_msg_tsg_fehlend2 set
primaerflag_studien_msg=M.primaerflag_studien
from tmp_studien_msg M
where tmp_studien_msg_tsg_fehlend2.st_studiengang_nr_msg=M.st_studiengang_nr
and tmp_studien_msg_tsg_fehlend2.st_studstamm_nr=M.st_studstamm_nr
and tmp_studien_msg_tsg_fehlend2.semester=M.semester;
--fehlende Semester nachtragen: --fehlende Semester nachtragen:
insert into tmp_studien_tsg(semester, insert into tmp_studien_tsg(semester,
@ -540,7 +550,8 @@ hzb_land_nr,
abm_art_s, abm_art_s,
fachsemester, fachsemester,
studienfach_sortierung, studienfach_sortierung,
letztes_tsg_semester letztes_tsg_semester,
primaerflag_studien_msg
) )
select distinct semester, select distinct semester,
semester_anfang, semester_anfang,
@ -579,7 +590,8 @@ hzb_land_nr,
abm_art_s, abm_art_s,
fachsemester, fachsemester,
studienfach_sortierung, studienfach_sortierung,
letztes_tsg_semester letztes_tsg_semester,
primaerflag_studien_msg
from tmp_studien_msg_tsg_fehlend2 F, costage_st_studiengaenge G from tmp_studien_msg_tsg_fehlend2 F, costage_st_studiengaenge G
where G.st_studiengang_nr=F.st_studiengang_nr_msg where G.st_studiengang_nr=F.st_studiengang_nr_msg
; ;
@ -659,6 +671,7 @@ abm_art_s,
fachsemester, fachsemester,
studienfach_sortierung, studienfach_sortierung,
letztes_tsg_semester, letztes_tsg_semester,
primaerflag_studien_msg,
'TSG'::char(10) as studiengangs_typ_kb, 'TSG'::char(10) as studiengangs_typ_kb,
null::integer as fach_nr, null::integer as fach_nr,
null::integer as studiengang_nr, null::integer as studiengang_nr,
@ -796,12 +809,15 @@ into temp tmp_primaer_msg
from tmp_studien2 from tmp_studien2
where studiengangs_typ_kb ='TSG' where studiengangs_typ_kb ='TSG'
and st_studiengang_nr_msg is not null and st_studiengang_nr_msg is not null
and primaerflag=1; --and primaerflag=1
and primaerflag_studien_msg=1
;
--select * from tmp_primaer_msg; --select * from tmp_primaer_msg;
update tmp_studien2 set studiengang_nr=1 where primaerflag=0 update tmp_studien2 set studiengang_nr=1 where primaerflag=0
and studiengangs_typ_kb ='TSG' and studiengangs_typ_kb ='TSG'
and primaerflag_studien_msg=1
and exists (select st_studiengang_nr_msg and exists (select st_studiengang_nr_msg
from tmp_primaer_msg T from tmp_primaer_msg T
where T.st_studstamm_nr=tmp_studien2.st_studstamm_nr where T.st_studstamm_nr=tmp_studien2.st_studstamm_nr

Loading…
Cancel
Save