Browse Source

Bugfixes merge 0.3 #15

basisressourcen
Daniel Quathamer 1 year ago
parent
commit
2f7b0cb641
  1. 31
      src-modules/module/costage/hilfstabellen/costage_st_studien_aggr_fuellen.sql
  2. 40
      src-modules/module/costage/rohdaten_sos/sos_costage_unload.xml
  3. 47
      src-modules/module/costage/schluesseltabellen/cifx_fuellen.sql
  4. 19
      src-modules/module/costage/upgrade/costage_upgrade_man.sql

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

@ -126,7 +126,9 @@ create index tmp_ix5 on tmp_studien(status_historie);
--Primärflag ermitteln: --Primärflag ermitteln:
--1. Prio: aus px_st_studien_v: --1. Prio: aus px_st_studien_v:
select T.*,1::integer as primaerflag select T.*,
1::integer as primaerflag,
null::integer as letztes_tsg_semester
into temp tmp_studien2 into temp tmp_studien2
from tmp_studien T from tmp_studien T
where T.status_historie=1 where T.status_historie=1
@ -136,7 +138,9 @@ from tmp_studien T
--2. Prio: aus costage_st_hauptstudien: --2. Prio: aus costage_st_hauptstudien:
insert into tmp_studien2 insert into tmp_studien2
select T.*,1::integer as primaerflag select T.*,
1::integer as primaerflag,
null::integer as letztes_tsg_semester
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
and H.st_studium_nr=T.st_studium_nr and H.st_studium_nr=T.st_studium_nr
@ -147,7 +151,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::integer as primaerflag select T.*,
0::integer 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
@ -175,6 +181,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
@ -317,8 +324,8 @@ hzb_land_sub_r_nr ,
hzb_jahr, hzb_jahr,
hzb_datum , hzb_datum ,
hzb_note, hzb_note,
fachsemester) fachsemester,
letztes_tsg_semester)
select M.semester, select M.semester,
M.semester_anfang, M.semester_anfang,
M.semester_ende, M.semester_ende,
@ -353,7 +360,8 @@ S.hzb_land_sub_r_nr ,
S.hzb_jahr, S.hzb_jahr,
S.hzb_datum , S.hzb_datum ,
S.hzb_note, S.hzb_note,
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
@ -364,7 +372,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,27,28,29,30 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
; ;
--statustyp und hrst nachladen: --statustyp und hrst nachladen:
@ -380,14 +388,15 @@ 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 and S.status_historie=1
; ;
@ -469,7 +478,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,42,43,44,45,46,47,48 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,43,44,45,46,47,48,49
; ;
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

40
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
@ -534,6 +538,30 @@ null as sortorder
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
SELECT
11,
-1,
S.land_kfz_kennzeichen_subregion as apnr,
substring(S.name from 1 for 10) as kurz,
substring(S.name from 1 for 255) as druck,
substring(S.name from 1 for 255) as lang_1,
S.statistik_code as astat,
null as parent,
S.land_kfz_kennzeichen_subregion, --sortc1 wird später uniquename
S.statistik_code as bund_apnr,
null as sprache,
null::date gueltig_von,
null::date gueltig_bis,
S.land_kfz_kennzeichen_subregion , --sourcesystem_id
' ', --hiskey_id
'' as struktur_c,
null as lid,
null as parent_lid,
null as sortorder
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,
@ -642,7 +670,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,

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