Browse Source

Bugfixes Fächer Duplikate, Fächergruppen, Fachsem. bei geschl. TSG #10

COStage_0.3_Release
Daniel Quathamer 1 year ago
parent
commit
225089fe21
  1. 29
      src-modules/module/costage/hilfstabellen/costage_st_studien_aggr_fuellen.sql
  2. 41
      src-modules/module/costage/rohdaten_sos/sos_costage_unload.xml
  3. 25
      src-modules/module/costage/rohdaten_zul/zul_costage_unload.xml
  4. 47
      src-modules/module/costage/schluesseltabellen/cifx_fuellen.sql
  5. 19
      src-modules/module/costage/upgrade/costage_upgrade_man.sql

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

@ -102,7 +102,9 @@ create index tmp_ix4 on tmp_studien(st_sem_nr);
create index tmp_ix5 on tmp_studien(status_historie); create index tmp_ix5 on tmp_studien(status_historie);
select T.*,1::smallint as primaerflag select T.*,
1::smallint as primaerflag,
null::integer as letztes_tsg_semester
into temp tmp_studien2 into temp tmp_studien2
from tmp_studien T, costage_st_hauptstudien H from tmp_studien T, costage_st_hauptstudien H
where H.st_studstamm_nr=T.st_studstamm_nr where H.st_studstamm_nr=T.st_studstamm_nr
@ -113,7 +115,9 @@ from tmp_studien T, costage_st_hauptstudien H
; ;
--Studiengänge ohne Primärflag: --Studiengänge ohne Primärflag:
insert into tmp_studien2 insert into tmp_studien2
select T.*,0::smallint as primaerflag select T.*,
0::smallint as primaerflag,
null::integer as letztes_tsg_semester
from tmp_studien T left outer join costage_st_hauptstudien H from tmp_studien T left outer join costage_st_hauptstudien H
on (H.st_studstamm_nr=T.st_studstamm_nr on (H.st_studstamm_nr=T.st_studstamm_nr
and H.st_studium_nr=T.st_studium_nr and H.st_studium_nr=T.st_studium_nr
@ -140,6 +144,7 @@ group by 1,2,3
--; --;
--zuerst den jeweils letzten (=jüngsten) MSG zuweisen: --zuerst den jeweils letzten (=jüngsten) MSG zuweisen:
--TODO: langsam:
update tmp_studien2 set st_studiengang_nr_msg=T.st_studiengang_nr_msg update tmp_studien2 set st_studiengang_nr_msg=T.st_studiengang_nr_msg
from tmp_studien T,tmp_last_msg_per_term E, costage_st_studiengaenge_mtsg M from tmp_studien T,tmp_last_msg_per_term E, costage_st_studiengaenge_mtsg M
where M.st_studiengang_nr_tsg=tmp_studien2.st_studiengang_nr where M.st_studiengang_nr_tsg=tmp_studien2.st_studiengang_nr
@ -278,8 +283,8 @@ statustyp_tsg,
tsg_generated, tsg_generated,
primaerflag, primaerflag,
hzb_art, hzb_art,
fachsemester) fachsemester,
letztes_tsg_semester)
select M.semester, select M.semester,
M.semester_anfang, M.semester_anfang,
M.semester_ende, M.semester_ende,
@ -310,7 +315,8 @@ null::char(10) as statustyp_tsg,
1 as tsg_generated, 1 as tsg_generated,
0 as primaerflag, --geschlossene TSG können kein Primärflag haben 0 as primaerflag, --geschlossene TSG können kein Primärflag haben
S.hzb_art, S.hzb_art,
max(S.fachsemester) null::integer as fachsemester,
max(S.semester)
from tmp_studien_msg_tsg_fehlend M, tmp_studien3 S --,costage_st_semester E from tmp_studien_msg_tsg_fehlend M, tmp_studien3 S --,costage_st_semester E
where M.st_studiengang_nr_msg=S.st_studiengang_nr_msg_possible where M.st_studiengang_nr_msg=S.st_studiengang_nr_msg_possible
and M.st_studiengang_nr_tsg=S.st_studiengang_nr and M.st_studiengang_nr_tsg=S.st_studiengang_nr
@ -321,7 +327,7 @@ and M.semester != S.semester
--and S.st_studiengang_nr_msg=34454 --and S.st_studiengang_nr_msg=34454
--and S.studiengangs_bezeichnung='Bildungswissenschaften' --and S.studiengangs_bezeichnung='Bildungswissenschaften'
--and M.semester=20211 --and M.semester=20211
group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,23,24,25,26 group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,23,24,25,26,27
; ;
--statustyp und hrst nachladen: --statustyp und hrst nachladen:
@ -337,15 +343,16 @@ and S.status_historie=1
; ;
--statustyp_stg nachladen: --statustyp_tsg nachladen:
update tmp_studien2 set statustyp_tsg=S.statustyp_tsg update tmp_studien2 set statustyp_tsg=S.statustyp_tsg,
fachsemester=S.fachsemester
from tmp_studien S from tmp_studien S
where tmp_studien2.st_studium_nr=S.st_studium_nr where tmp_studien2.st_studium_nr=S.st_studium_nr
and tmp_studien2.st_studstamm_nr=S.st_studstamm_nr and tmp_studien2.st_studstamm_nr=S.st_studstamm_nr
and S.studiengangs_typ_kb ='TSG' and S.studiengangs_typ_kb ='TSG'
and tmp_studien2.tsg_generated=1 and tmp_studien2.tsg_generated=1
and tmp_studien2.fachsemester=S.fachsemester and tmp_studien2.letztes_tsg_semester=S.semester
and S.status_historie=1
; ;
drop table tmp_studien_msg_tsg_fehlend; drop table tmp_studien_msg_tsg_fehlend;
@ -426,7 +433,7 @@ into temp tmp_studien3
from tmp_studien2 T left outer join costage_st_studien_spoversionen SPO from tmp_studien2 T left outer join costage_st_studien_spoversionen SPO
on (SPO.st_studium_nr=T.st_studium_nr on (SPO.st_studium_nr=T.st_studium_nr
and SPO.gueltig_ab < T.semester_ende) and SPO.gueltig_ab < T.semester_ende)
group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41 group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42
; ;
update tmp_studien3 set po_stp_stp_version_kb= SPO.po_stp_stp_version_kb update tmp_studien3 set po_stp_stp_version_kb= SPO.po_stp_stp_version_kb

41
src-modules/module/costage/rohdaten_sos/sos_costage_unload.xml

@ -103,10 +103,10 @@ ca12_staat,
null::integer as bland, null::integer as bland,
null::char(1) ,--hssem, null::char(1) ,--hssem,
null::char(1) ,--urlsem, null::char(1) ,--urlsem,
null::char(1) as hmkfzkz, (case when AH.land_kfz_kennzeichen='D' then 'I' else 'A' end) as hmkfzkz,
null::char(1) as hmkfz, (case when AH.land_kfz_kennzeichen='D' then AH.land_kfz_kennzeichen_subregion else AH.land_kfz_kennzeichen end) as hmkfz,
null::char(1) as semkfzkz, (case when ASEM.land_kfz_kennzeichen='D' then 'I' else 'A' end) as semkfzkz,
null::char(1) as semkfz, (case when ASEM.land_kfz_kennzeichen='D' then ASEM.land_kfz_kennzeichen_subregion else ASEM.land_kfz_kennzeichen end) as semkfz,
null::char(1) as hzbart, null::char(1) as hzbart,
null::char(1) as hzbjahr, null::char(1) as hzbjahr,
null::char(1) as hzbkfzkz, null::char(1) as hzbkfzkz,
@ -142,7 +142,11 @@ null::integer AS geba,
null::integer AS geba_sws, null::integer AS geba_sws,
null::integer AS ersthzbjahr, null::integer AS ersthzbjahr,
null::integer AS ersthzbnote null::integer AS ersthzbnote
FROM costage_st_studierendenstammdaten FROM (costage_st_studierendenstammdaten S left outer join
costage_st_adressen AH on (AH.st_studstamm_nr=S.st_studstamm_nr
and AH.st_adresse_typ='H'))
left outer join costage_st_adressen ASEM on (ASEM.st_studstamm_nr=S.st_studstamm_nr
and ASEM.st_adresse_typ='S')
where where
matrikelnummer is not null matrikelnummer is not null
and semester_max >= $start_stud_sem and semester_max >= $start_stud_sem
@ -518,27 +522,28 @@ null as sortorder
union union
SELECT SELECT
30, 11,
-1, -1,
apnr, S.land_kfz_kennzeichen_subregion as apnr,
kurz, substring(S.name from 1 for 10) as kurz,
druck, substring(S.name from 1 for 255) as druck,
lang_1, substring(S.name from 1 for 255) as lang_1,
astat, S.statistik_code as astat,
null as parent, null as parent,
apnr, --sortc1 wird später uniquename S.land_kfz_kennzeichen_subregion, --sortc1 wird später uniquename
null as bund_apnr, S.statistik_code as bund_apnr,
null as sprache, null as sprache,
null::date gueltig_von, null::date gueltig_von,
null::date gueltig_bis, null::date gueltig_bis,
apnr , --sourcesystem_id S.land_kfz_kennzeichen_subregion , --sourcesystem_id
' ', --hiskey_id ' ', --hiskey_id
struktur_c as fb, '' as struktur_c,
null as lid, null as lid,
null as parent_lid, null as parent_lid,
null as sortorder null as sortorder
FROM cifx where key=30 FROM costage_land_subregionen S, costage_st_land_regionen R
where R.st_land_reg_nr=S.st_land_reg_nr
and R.st_land_nr=56
union union
SELECT distinct SELECT distinct
612, 612,
@ -647,7 +652,7 @@ null as sortorder
'' , '' ,
null::date as gueltig_von, null::date as gueltig_von,
null::date as gueltig_bis, null::date as gueltig_bis,
kurzbezeichnung, --sourcesystem_id st_land_nr::varchar(255), --sourcesystem_id
'' , --hiskey_id '' , --hiskey_id
'' ,--egmitgl struktur_c '' ,--egmitgl struktur_c
null as lid, null as lid,

25
src-modules/module/costage/rohdaten_zul/zul_costage_unload.xml

@ -455,30 +455,7 @@ null as parent_lid
on (F.st_absz_amtstat_nr=L.st_absz_amtstat_nr) on (F.st_absz_amtstat_nr=L.st_absz_amtstat_nr)
WHERE L.code is not null WHERE L.code is not null
union union
SELECT
30,
-1,
apnr,
kurz,
druck,
lang_1,
astat,
null as parent,
apnr, --sortc1 wird später uniquename
null::integer as sortorder,
null as bund_apnr,
null as sprache,
null::date gueltig_von,
null::date gueltig_bis,
apnr , --sourcesystem_id
' ', --hiskey_id
struktur_c as fb,
null as lid,
null as parent_lid
FROM cifx where key=30
union
SELECT distinct SELECT distinct
612, 612,
-1, -1,

47
src-modules/module/costage/schluesseltabellen/cifx_fuellen.sql

@ -1,5 +1,10 @@
--Freemarker Template --Freemarker Template
<sqlvars>
<sqlvar name="kenn_dim_fgr_exists">
select sp_table_exists('kenn_dim_fgr') from xdummy
</sqlvar>
</sqlvars>
<#assign dimensions = [ <#assign dimensions = [
{"key":"400", "name":"Statustyp (CO)"}, {"key":"400", "name":"Statustyp (CO)"},
@ -165,6 +170,48 @@ NULL::char(10) as hiskey_id ,
</#foreach> </#foreach>
<#if kenn_dim_fgr_exists==1>
insert into tmp_cifx
(
key ,
hs,
apnr ,
kurz ,
druck,
lang_1 ,
astat,
uniquename ,
d_akt_von ,
d_akt_bis ,
sourcesystem_id ,
sourcesystem,
lid ,
--parent_lid,
hiskey_id ,
struktur_c
)
select
621 as key ,
0 as hs,
'0' || trim(apnr) || '0' as apnr,
substring(drucktext from 1 for 10) as kurz ,
drucktext as druck,
drucktext as lang_1 ,
apnr as astat,
'0' || trim(apnr) || '0' as uniquename ,
date_val('01.01.1900') as d_akt_von ,
date_val('01.01.3000')d_akt_bis ,
apnr as sourcesystem_id ,
15 as sourcesystem,
'0' || trim(apnr) || '0' as lid ,
--parent_lid,
NULL::char(10) as hiskey_id,
'' as struktur_c
from kenn_dim_fgr
where string_not_null(fg_studierende)!='';
</#if>
--Duplikate raus: --Duplikate raus:
select T.key,T.apnr select T.key,T.apnr
from tmp_cifx T from tmp_cifx T

19
src-modules/module/costage/upgrade/costage_upgrade_man.sql

@ -17,3 +17,22 @@ ALTER COLUMN matrikelnummer drop not null;
</#if> </#if>
--Länder Schlüssel ggf. doppelt aus sospos, daher löschen:
delete from cifx C
where key=12
and astat is not null
AND (today()>=d_akt_von AND today()<=d_akt_bis)
and 0=(select count(*) from costage_st_laender L
where L.kfz_kennzeichen=C.apnr)
and (select count(*) from costage_st_laender L2)>0 --wenn die Tab. überhaupt gefüllt ist
;
--Länder Schlüssel ggf. doppelt aus sospos, daher löschen:
delete from cifx C
where key=11
and astat is not null
AND (today()>=d_akt_von AND today()<=d_akt_bis)
and 0=(select count(*) from costage_land_subregionen L
where L.land_kfz_kennzeichen_subregion=C.apnr)
and (select count(*) from costage_land_subregionen L2)>0 --wenn die Tab. überhaupt gefüllt ist
;

Loading…
Cancel
Save