Browse Source

Já už nevím, jak určovat deadliny řešení…

pull/3/head
Jonas Havelka 2 years ago
parent
commit
261f2447e3
  1. 39
      seminar/migrations/0104_hodnoceni_deadline_body.py

39
seminar/migrations/0104_hodnoceni_deadline_body.py

@ -14,39 +14,44 @@ def prirad_deadliny(apps, schema_editor):
p = h.problem p = h.problem
try: try:
u = p.uloha t = p.tema
if u.cislo_zadani is not None: d = Deadline.objects.filter(cislo__rocnik=t.rocnik, deadline__gte=h.reseni.cas_doruceni).first()
d = Deadline.objects.filter(cislo=u.cislo_zadani, deadline__gte=h.reseni.cas_doruceni).first()
if d is None:
d = Deadline.objects.filter(cislo__rocnik=t.rocnik).last()
h.deadline_body = d h.deadline_body = d
h.save() h.save()
continue
except Exception: except Exception:
pass pass
cislo = None
try:
u = p.uloha
cislo = u.cislo_zadani
except Exception:
pass
try: try:
c = p.clanek c = p.clanek
if c.cislo is not None: if c.cislo is not None:
d = Deadline.objects.filter(cislo=c.cislo, deadline__gte=h.reseni.cas_doruceni).first() cislo = c.cislo
h.deadline_body = d
h.save()
continue
except Exception: except Exception:
pass pass
try: if cislo is None:
t = p.tema cislo = h.cislo_body
d = Deadline.objects.filter(cislo__rocnik=t.rocnik, deadline__gte=h.reseni.cas_doruceni).first()
if cislo is not None:
d = Deadline.objects.filter(cislo=cislo, deadline__gte=h.reseni.cas_doruceni).first()
if d is None: if d is None:
d = Deadline.objects.filter(cislo__rocnik=t.rocnik).last() d = Deadline.objects.filter(cislo=cislo).last()
h.deadline_body = d h.deadline_body = d
h.save() h.save()
continue
except Exception:
pass
log.warning(f"Deadline hodnocení {h.id} se nepodařil určit exaktnějším způsobem. Zkouším další.") log.warning(f"Deadline hodnocení {h.id} se nepodařil určit exaktnějším způsobem. Zkouším další.")

Loading…
Cancel
Save