|
@ -12,25 +12,23 @@ import seminar.models as m |
|
|
def vytvor_deadliny(apps, schema_editor): |
|
|
def vytvor_deadliny(apps, schema_editor): |
|
|
Cislo = apps.get_model('seminar', 'Cislo') |
|
|
Cislo = apps.get_model('seminar', 'Cislo') |
|
|
Deadline = apps.get_model('seminar', 'Deadline') |
|
|
Deadline = apps.get_model('seminar', 'Deadline') |
|
|
Hodnoceni = apps.get_model('seminar', 'Hodnoceni') |
|
|
|
|
|
|
|
|
|
|
|
for cislo in Cislo.objects.all(): |
|
|
for cislo in Cislo.objects.all(): |
|
|
if not (cislo.datum_deadline or cislo.datum_deadline_soustredeni or cislo.datum_preddeadline): |
|
|
if cislo.rocnik.rocnik < 26: |
|
|
h = Hodnoceni.objects.filter(problem__uloha__cislo_zadani=cislo).order_by(F("reseni__cas_doruceni")).last() |
|
|
d = Deadline() |
|
|
|
|
|
d.cislo = cislo |
|
|
if h is None: |
|
|
d.typ = m.Deadline.TYP_CISLA |
|
|
h = Hodnoceni.objects.filter(cislo_body=cislo).order_by(F("reseni__cas_doruceni")).last() |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(datetime.date(1994 + cislo.rocnik.rocnik, 6, int(cislo.poradi[0])), datetime.time.min)) |
|
|
|
|
|
d.verejna_vysledkovka = cislo.verejna_vysledkovka |
|
|
if h is not None: |
|
|
d.save() |
|
|
cislo.datum_deadline = h.reseni.cas_doruceni.date() |
|
|
continue |
|
|
cislo.save() |
|
|
|
|
|
|
|
|
|
|
|
if cislo.datum_deadline_soustredeni and cislo.datum_deadline_soustredeni == cislo.datum_preddeadline: |
|
|
if cislo.datum_deadline_soustredeni and cislo.datum_deadline_soustredeni == cislo.datum_preddeadline: |
|
|
d = Deadline() |
|
|
d = Deadline() |
|
|
d.cislo = cislo |
|
|
d.cislo = cislo |
|
|
d.typ = m.Deadline.TYP_PRVNI_A_SOUS |
|
|
d.typ = m.Deadline.TYP_PRVNI_A_SOUS |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_deadline_soustredeni, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_deadline_soustredeni, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
d.verejna_vysledkovka = cislo.verejna_vysledkovka |
|
|
d.verejna_vysledkovka = True |
|
|
d.save() |
|
|
d.save() |
|
|
else: |
|
|
else: |
|
|
if cislo.datum_deadline_soustredeni: |
|
|
if cislo.datum_deadline_soustredeni: |
|
@ -38,14 +36,14 @@ def vytvor_deadliny(apps, schema_editor): |
|
|
d.cislo = cislo |
|
|
d.cislo = cislo |
|
|
d.typ = m.Deadline.TYP_SOUS |
|
|
d.typ = m.Deadline.TYP_SOUS |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_deadline_soustredeni, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_deadline_soustredeni, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
d.verejna_vysledkovka = cislo.verejna_vysledkovka |
|
|
d.verejna_vysledkovka = True |
|
|
d.save() |
|
|
d.save() |
|
|
if cislo.datum_preddeadline: |
|
|
if cislo.datum_preddeadline: |
|
|
d = Deadline() |
|
|
d = Deadline() |
|
|
d.cislo = cislo |
|
|
d.cislo = cislo |
|
|
d.typ = m.Deadline.TYP_PRVNI |
|
|
d.typ = m.Deadline.TYP_PRVNI |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_preddeadline, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_preddeadline, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
d.verejna_vysledkovka = cislo.verejna_vysledkovka |
|
|
d.verejna_vysledkovka = True |
|
|
d.save() |
|
|
d.save() |
|
|
|
|
|
|
|
|
if cislo.datum_deadline: |
|
|
if cislo.datum_deadline: |
|
@ -53,7 +51,7 @@ def vytvor_deadliny(apps, schema_editor): |
|
|
d.cislo = cislo |
|
|
d.cislo = cislo |
|
|
d.typ = m.Deadline.TYP_CISLA |
|
|
d.typ = m.Deadline.TYP_CISLA |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_deadline, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_deadline, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
d.verejna_vysledkovka = cislo.verejna_vysledkovka |
|
|
d.verejna_vysledkovka = True |
|
|
d.save() |
|
|
d.save() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|