@ -516,31 +516,6 @@ class Migration(migrations.Migration):
]
operations = [
migrations . CreateModel (
name = ' VysledkyKCislu ' ,
fields = [
( ' dummy_id ' , models . CharField ( db_column = ' id ' , max_length = 32 , primary_key = True , serialize = False , verbose_name = ' dummy ID pro view ' ) ) ,
( ' body ' , models . IntegerField ( db_column = ' body ' , verbose_name = ' body za číslo ' ) ) ,
( ' body_celkem ' , models . IntegerField ( db_column = ' body_celkem ' , verbose_name = ' body celkem do čísla ' ) ) ,
] ,
options = {
' abstract ' : False ,
' db_table ' : ' seminar_body_k_cislu ' ,
' managed ' : False ,
} ,
) ,
migrations . CreateModel (
name = ' VysledkyZaCislo ' ,
fields = [
( ' dummy_id ' , models . CharField ( db_column = ' id ' , max_length = 32 , primary_key = True , serialize = False , verbose_name = ' dummy ID pro view ' ) ) ,
( ' body ' , models . IntegerField ( db_column = ' body ' , verbose_name = ' body za číslo ' ) ) ,
] ,
options = {
' abstract ' : False ,
' db_table ' : ' seminar_body_za_cislo ' ,
' managed ' : False ,
} ,
) ,
migrations . CreateModel (
name = ' Cislo ' ,
fields = [
@ -720,37 +695,6 @@ class Migration(migrations.Migration):
name = ' rocnik ' ,
field = models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , related_name = ' cisla ' , to = ' seminar.Rocnik ' , verbose_name = ' ročník ' ) ,
) ,
migrations . RunSQL (
sql = "
create view seminar_body_za_cislo as
select
sr . cislo_body_id | | ' - ' | | sr . resitel_id as id ,
sr . cislo_body_id as cislo_id ,
sr . resitel_id as resitel_id ,
sum ( sr . body ) as body
from seminar_reseni as sr
group by sr . cislo_body_id , sr . resitel_id
order by body desc ;
create view seminar_body_k_cislu as
select
akt_c . id | | ' - ' | | min_bzc . resitel_id as id ,
akt_c . id as cislo_id ,
min_bzc . resitel_id as resitel_id ,
max ( akt_bzc . body ) as body ,
sum ( min_bzc . body ) as body_celkem
from ( ( seminar_cisla as akt_c
inner join seminar_cisla as min_c on min_c . rocnik_id = akt_c . rocnik_id and akt_c . cislo > = min_c . cislo )
inner join seminar_body_za_cislo as min_bzc on min_c . id = min_bzc . cislo_id )
left outer join seminar_body_za_cislo as akt_bzc on akt_bzc . cislo_id = akt_c . id and akt_bzc . resitel_id = min_bzc . resitel_id
group by akt_c . id , min_bzc . resitel_id , akt_bzc . resitel_id
order by body_celkem desc ;
" ,
reverse_sql = '
drop view seminar_body_k_cislu ;
drop view seminar_body_za_cislo ;
' ,
) ,
migrations . AlterField (
model_name = ' reseni ' ,
name = ' poznamka ' ,
@ -969,9 +913,6 @@ class Migration(migrations.Migration):
name = ' verejna_vysledkovka ' ,
field = models . BooleanField ( default = False , help_text = ' Je-li false u veřejného čísla, není výsledkovka zatím veřejná. ' , verbose_name = ' zveřejněna výsledkovka ' ) ,
) ,
migrations . RunSQL (
sql = ' \n drop view seminar_body_k_cislu; \n drop view seminar_body_za_cislo; \n ' ,
) ,
migrations . AlterField (
model_name = ' problem ' ,
name = ' body ' ,
@ -982,33 +923,6 @@ class Migration(migrations.Migration):
name = ' body ' ,
field = models . DecimalField ( blank = True , decimal_places = 1 , max_digits = 8 , null = True , verbose_name = ' body ' ) ,
) ,
migrations . RunSQL (
sql = "
create view seminar_body_za_cislo as
select
sr . cislo_body_id | | ' - ' | | sr . resitel_id as id ,
sr . cislo_body_id as cislo_id ,
sr . resitel_id as resitel_id ,
sum ( sr . body ) as body
from seminar_reseni as sr
group by sr . cislo_body_id , sr . resitel_id
order by body desc ;
create view seminar_body_k_cislu as
select
akt_c . id | | ' - ' | | min_bzc . resitel_id as id ,
akt_c . id as cislo_id ,
min_bzc . resitel_id as resitel_id ,
max ( akt_bzc . body ) as body ,
sum ( min_bzc . body ) as body_celkem
from ( ( seminar_cisla as akt_c
inner join seminar_cisla as min_c on min_c . rocnik_id = akt_c . rocnik_id and akt_c . cislo > = min_c . cislo )
inner join seminar_body_za_cislo as min_bzc on min_c . id = min_bzc . cislo_id )
left outer join seminar_body_za_cislo as akt_bzc on akt_bzc . cislo_id = akt_c . id and akt_bzc . resitel_id = min_bzc . resitel_id
group by akt_c . id , min_bzc . resitel_id , akt_bzc . resitel_id
order by body_celkem desc ;
" ,
) ,
migrations . CreateModel (
name = ' Novinky ' ,
fields = [
@ -1057,136 +971,6 @@ class Migration(migrations.Migration):
name = ' typ ' ,
field = models . CharField ( choices = [ ( b ' jarni ' , ' Jarní soustředění ' ) , ( b ' podzimni ' , ' Podzimní soustředění ' ) , ( b ' vikend ' , ' Víkendový sraz ' ) ] , default = b ' podzimni ' , max_length = 16 , verbose_name = ' typ akce ' ) ,
) ,
migrations . RunSQL (
sql = "
drop view seminar_body_k_cislu ;
drop view seminar_body_za_cislo ;
create view seminar_body_za_cislo as
select
seminar_reseni . cislo_body_id | | ' - ' | | seminar_reseni . resitel_id as id ,
seminar_reseni . cislo_body_id as cislo_id ,
seminar_reseni . resitel_id as resitel_id ,
seminar_cisla . cislo as cislo ,
seminar_cisla . rocnik_id as rocnik_id ,
seminar_rocniky . rocnik as rocnik ,
seminar_cisla . verejna_vysledkovka as verejna_vysledkovka ,
sum ( seminar_reseni . body ) as body
from
seminar_reseni
inner join seminar_cisla on seminar_reseni . cislo_body_id = seminar_cisla . id
inner join seminar_rocniky on seminar_cisla . rocnik_id = seminar_rocniky . id
group by seminar_reseni . cislo_body_id , seminar_reseni . resitel_id , seminar_cisla . cislo ,
seminar_cisla . rocnik_id , seminar_rocniky . rocnik , seminar_cisla . verejna_vysledkovka
order by body desc ;
create view seminar_body_k_cislu_rocnik as
select
akt_body . id as id ,
akt_body . cislo_id as cislo_id ,
akt_body . resitel_id as resitel_id ,
akt_body . body as body ,
sum ( min_body . body ) as body_celkem
from
seminar_body_za_cislo as akt_body
inner join seminar_body_za_cislo as min_body on
( akt_body . resitel_id = min_body . resitel_id and
( akt_body . rocnik = min_body . rocnik and akt_body . cislo > = min_body . cislo )
)
group by akt_body . id , akt_body . cislo_id , akt_body . resitel_id , akt_body . body
order by body_celkem desc ;
create view seminar_body_k_cislu_odjakziva as
select
akt_body . id as id ,
akt_body . cislo_id as cislo_id ,
akt_body . resitel_id as resitel_id ,
akt_body . body as body ,
sum ( min_body . body ) as body_celkem
from
seminar_body_za_cislo as akt_body
inner join seminar_body_za_cislo as min_body on
( akt_body . resitel_id = min_body . resitel_id and
( ( akt_body . rocnik = min_body . rocnik and akt_body . cislo > = min_body . cislo ) or
( akt_body . rocnik < min_body . rocnik )
)
)
group by akt_body . id , akt_body . cislo_id , akt_body . resitel_id , akt_body . body
order by body_celkem desc ;
" ,
) ,
migrations . RunSQL (
sql = "
drop view seminar_body_k_cislu_rocnik ;
create view seminar_body_k_cislu_rocnik as
select
seminar_cisla . id | | ' - ' | | min_body . resitel_id as id ,
seminar_cisla . id as cislo_id ,
min_body . resitel_id as resitel_id ,
sum ( min_body . body ) as body
from
seminar_cisla
inner join seminar_body_za_cislo as min_body on
( min_body . rocnik_id = seminar_cisla . rocnik_id and seminar_cisla . cislo > = min_body . cislo )
group by seminar_cisla . id , min_body . resitel_id
order by body desc ;
drop view seminar_body_k_cislu_odjakziva ;
create view seminar_body_k_cislu_odjakziva as
select
seminar_cisla . id | | ' - ' | | min_body . resitel_id as id ,
seminar_cisla . id as cislo_id ,
min_body . resitel_id as resitel_id ,
sum ( min_body . body ) as body
from
seminar_cisla
inner join seminar_rocniky on
( seminar_cisla . rocnik_id = seminar_rocniky . id )
inner join seminar_body_za_cislo as min_body on
( min_body . rocnik_id = seminar_cisla . rocnik_id and seminar_cisla . cislo > = min_body . cislo ) or
( min_body . rocnik < seminar_rocniky . rocnik )
group by seminar_cisla . id , min_body . resitel_id
order by body desc ;
" ,
) ,
migrations . CreateModel (
name = ' VysledkyCelkemKCislu ' ,
fields = [
( ' dummy_id ' , models . CharField ( db_column = b ' id ' , max_length = 32 , primary_key = True , serialize = False , verbose_name = ' dummy ID pro view ' ) ) ,
( ' body ' , models . DecimalField ( db_column = b ' body ' , decimal_places = 1 , max_digits = 8 , verbose_name = ' body za číslo ' ) ) ,
( ' body_celkem ' , models . DecimalField ( db_column = b ' body_celkem ' , decimal_places = 1 , max_digits = 8 , verbose_name = ' body celkem do čísla včetně minulých ročníků ' ) ) ,
] ,
options = {
' abstract ' : False ,
' db_table ' : ' seminar_body_celkem_k_cislu ' ,
' managed ' : False ,
} ,
) ,
migrations . CreateModel (
name = ' VysledkyKCisluOdjakziva ' ,
fields = [
( ' dummy_id ' , models . CharField ( db_column = b ' id ' , max_length = 32 , primary_key = True , serialize = False , verbose_name = ' dummy ID pro view ' ) ) ,
( ' body ' , models . DecimalField ( db_column = b ' body ' , decimal_places = 1 , max_digits = 8 , verbose_name = ' body za číslo ' ) ) ,
] ,
options = {
' abstract ' : False ,
' db_table ' : ' seminar_body_k_cislu_odjakziva ' ,
' managed ' : False ,
} ,
) ,
migrations . CreateModel (
name = ' VysledkyKCisluZaRocnik ' ,
fields = [
( ' dummy_id ' , models . CharField ( db_column = b ' id ' , max_length = 32 , primary_key = True , serialize = False , verbose_name = ' dummy ID pro view ' ) ) ,
( ' body ' , models . DecimalField ( db_column = b ' body ' , decimal_places = 1 , max_digits = 8 , verbose_name = ' body za číslo ' ) ) ,
] ,
options = {
' abstract ' : False ,
' db_table ' : ' seminar_body_k_cislu_rocnik ' ,
' managed ' : False ,
} ,
) ,
migrations . AlterField (
model_name = ' organizator ' ,
name = ' foto ' ,