|
@ -11,7 +11,7 @@ def prirad_deadliny(apps, schema_editor): |
|
|
Deadline = apps.get_model('seminar', 'Deadline') |
|
|
Deadline = apps.get_model('seminar', 'Deadline') |
|
|
|
|
|
|
|
|
for h in Hodnoceni.objects.all(): |
|
|
for h in Hodnoceni.objects.all(): |
|
|
if h.cislo_body is not None and h.cislo_body.rocnik.rocnik < 26: |
|
|
if h.cislo_body is not None and h.cislo_body.rocnik.rocnik < -1: |
|
|
# Deadline připravený v minulé migraci |
|
|
# Deadline připravený v minulé migraci |
|
|
h.deadline_body = h.cislo_body.deadline_v_cisle.get() |
|
|
h.deadline_body = h.cislo_body.deadline_v_cisle.get() |
|
|
h.save() |
|
|
h.save() |
|
@ -19,7 +19,7 @@ def prirad_deadliny(apps, schema_editor): |
|
|
|
|
|
|
|
|
p = h.problem |
|
|
p = h.problem |
|
|
|
|
|
|
|
|
try: |
|
|
if p.polymorphic_ctype.model == 'tema': |
|
|
t = p.tema |
|
|
t = p.tema |
|
|
d = Deadline.objects.filter(cislo__rocnik=t.rocnik, deadline__gte=h.reseni.cas_doruceni).first() |
|
|
d = Deadline.objects.filter(cislo__rocnik=t.rocnik, deadline__gte=h.reseni.cas_doruceni).first() |
|
|
|
|
|
|
|
@ -31,24 +31,16 @@ def prirad_deadliny(apps, schema_editor): |
|
|
h.save() |
|
|
h.save() |
|
|
continue |
|
|
continue |
|
|
|
|
|
|
|
|
except Exception: |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cislo = None |
|
|
cislo = None |
|
|
|
|
|
|
|
|
try: |
|
|
if p.polymorphic_ctype.model == 'uloha': |
|
|
u = p.uloha |
|
|
u = p.uloha |
|
|
cislo = u.cislo_zadani |
|
|
cislo = u.cislo_zadani |
|
|
except Exception: |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
if p.polymorphic_ctype.model == 'clanek': |
|
|
c = p.clanek |
|
|
c = p.clanek |
|
|
if c.cislo is not None: |
|
|
if c.cislo is not None: |
|
|
cislo = c.cislo |
|
|
cislo = c.cislo |
|
|
except Exception: |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
if cislo is None: |
|
|
if cislo is None: |
|
|
cislo = h.cislo_body |
|
|
cislo = h.cislo_body |
|
@ -68,6 +60,8 @@ def prirad_deadliny(apps, schema_editor): |
|
|
h.deadline_body = d |
|
|
h.deadline_body = d |
|
|
h.save() |
|
|
h.save() |
|
|
|
|
|
|
|
|
|
|
|
# Zběžná kontrola. Předpokládá, že M&M má méně než 10 čísel v ročníku |
|
|
|
|
|
# a že první znak pořadí je int určující dané pořadí (schroustání 7-8). |
|
|
if h.cislo_body and ( |
|
|
if h.cislo_body and ( |
|
|
int(h.deadline_body.cislo.poradi[0]) + 2 < int(h.cislo_body.poradi[0]) |
|
|
int(h.deadline_body.cislo.poradi[0]) + 2 < int(h.cislo_body.poradi[0]) |
|
|
or int(h.deadline_body.cislo.poradi[0]) > int(h.cislo_body.poradi[0]) |
|
|
or int(h.deadline_body.cislo.poradi[0]) > int(h.cislo_body.poradi[0]) |
|
|