Browse Source

Counting heads, performance of primary flag improved #2

COStage_0.2_Release
Daniel Quathamer 3 years ago
parent
commit
95057759b0
  1. 88
      src-modules/module/costage/hilfstabellen/costage_st_studien_aggr_fuellen.sql
  2. 2
      src-modules/module/sos/rohdaten/sos_costage_unload.xml

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

@ -30,7 +30,7 @@ null::char(10) as hrst, @@ -30,7 +30,7 @@ null::char(10) as hrst,
null::integer as fachsemester,
null::integer as hssem,
null::char(10) as statustyp,
0::smallint as primaerflag,
--0::smallint as primaerflag,
null::integer as studiengang_nr,
null::integer as fach_nr,
null::char(10) as unikey,
@ -91,35 +91,79 @@ and F.st_sem_nr=tmp_studien.st_sem_nr @@ -91,35 +91,79 @@ and F.st_sem_nr=tmp_studien.st_sem_nr
and F.fachsemestertyp='HS'
;
--todo: langsam:
update tmp_studien
set primaerflag=1
where exists (select st_studstamm_nr
from costage_st_hauptstudien H
where H.st_studstamm_nr=tmp_studien.st_studstamm_nr
and H.st_studium_nr=tmp_studien.st_studium_nr
and H.st_sem_nr=tmp_studien.st_sem_nr);
-- update tmp_studien
-- set primaerflag=1
-- where exists (select st_studstamm_nr
-- from costage_st_hauptstudien H
-- where H.st_studstamm_nr=tmp_studien.st_studstamm_nr
-- and H.st_studium_nr=tmp_studien.st_studium_nr
-- and H.st_sem_nr=tmp_studien.st_sem_nr);
select T.*,1::smallint as primaerflag
into temp tmp_studien2
from tmp_studien T, costage_st_hauptstudien H
where H.st_studstamm_nr=T.st_studstamm_nr
and H.st_studium_nr=T.st_studium_nr
and H.st_sem_nr=T.st_sem_nr
and status_historie=1
;
--Studiengänge ohne Primärflag:
insert into tmp_studien2
select T.*,0::smallint as primaerflag
from tmp_studien T left outer join costage_st_hauptstudien H
on (H.st_studstamm_nr=T.st_studstamm_nr
and H.st_studium_nr=T.st_studium_nr
and H.st_sem_nr=T.st_sem_nr)
where T.status_historie=1
and H.st_studstamm_nr is null
;
drop table tmp_studien;
--Ermittlung msg:
update tmp_studien2 set st_studiengang_nr_msg=M.st_studiengang_nr_msg
from costage_st_studiengaenge_mtsg M, costage_st_studien ST
where ST.st_studiengang_nr=M.st_studiengang_nr_msg
and ST.st_studstamm_nr=tmp_studien2.st_studstamm_nr
and M.st_studiengang_nr_tsg=tmp_studien2.st_studiengang_nr
and tmp_studien2.studiengangs_typ_kb ='TSG'
;
update tmp_studien set fach_nr=M.studienfach_sortierung
--Ermittlung fach_nr:
update tmp_studien2 set fach_nr=M.studienfach_sortierung
from costage_st_studiengaenge_mtsg M
where M.st_studiengang_nr_tsg=tmp_studien.st_studiengang_nr
where M.st_studiengang_nr_msg=tmp_studien2.st_studiengang_nr_msg
and M.st_studiengang_nr_tsg=tmp_studien2.st_studiengang_nr
and tmp_studien2.studiengangs_typ_kb ='TSG'
;
update tmp_studien set fach_nr=1
update tmp_studien2 set fach_nr=1
where fach_nr is null;
--Ermittlung status bei TSG aus MSG:
update tmp_studien2 set studienstatustyp=SA.studienstatustyp
from costage_st_studienstatus SA, costage_st_studiengaenge SG ,costage_st_studien ST
where SG.st_studiengang_nr=tmp_studien2.st_studiengang_nr_msg
and ST.st_studium_nr=SA.st_studium_nr
and ST.st_studstamm_nr=tmp_studien2.st_studstamm_nr
and SA.st_sem_nr=tmp_studien2.st_sem_nr
and tmp_studien2.studiengangs_typ_kb ='TSG'
;
update tmp_studien set unikey=val(K.unikey)
update tmp_studien2 set unikey=K.unikey
from costage_st_studiengaenge G, costage_st_studienkennzahlen K
where G.st_studiengang_nr=tmp_studien.st_studiengang_nr
where G.st_studiengang_nr=tmp_studien2.st_studiengang_nr
and K.st_skz_nr=G.st_skz_nr
;
update tmp_studien set kz_rueck_beur_ein=(select val(astat)
update tmp_studien2 set kz_rueck_beur_ein=(select val(astat)
from cifx where key=400
and apnr=tmp_studien.studienstatustyp
and apnr=tmp_studien2.studienstatustyp
);
--wenn die Exmatrikulation zum Semesterende stattfand, wird Status auf Rückgemeldet gesetzt:
delete from costage_st_studien_aggr;
@ -156,7 +200,9 @@ select st_studium_nr, @@ -156,7 +200,9 @@ select st_studium_nr,
fachsemester,
hssem,
primaerflag,
rank () over (partition by semester, st_studstamm_nr order by primaerflag desc,st_studium_nr asc)
rank () over (partition by semester, st_studstamm_nr order by primaerflag desc,
(case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end )
)
as studiengang_nr,
fach_nr,
unikey,
@ -167,10 +213,10 @@ select st_studium_nr, @@ -167,10 +213,10 @@ select st_studium_nr,
else null::date end) as endedat,
studienform_statistik_code as stufrm,
kz_rueck_beur_ein
from tmp_studien
where status_historie=1;
from tmp_studien2
;
drop table tmp_studien;
drop table tmp_studien2;

2
src-modules/module/sos/rohdaten/sos_costage_unload.xml

@ -5629,7 +5629,7 @@ where 1=0; @@ -5629,7 +5629,7 @@ where 1=0;
<![CDATA[
SELECT apnr,
'A' as aikz,
apnr as stg,
kurz,
druck,
lang_1,
astat,

Loading…
Cancel
Save