Já už nevím, jak určovat deadliny řešení…
This commit is contained in:
parent
87e51ac744
commit
261f2447e3
1 changed files with 27 additions and 22 deletions
|
@ -13,28 +13,6 @@ def prirad_deadliny(apps, schema_editor):
|
||||||
for h in Hodnoceni.objects.all():
|
for h in Hodnoceni.objects.all():
|
||||||
p = h.problem
|
p = h.problem
|
||||||
|
|
||||||
try:
|
|
||||||
u = p.uloha
|
|
||||||
if u.cislo_zadani is not None:
|
|
||||||
d = Deadline.objects.filter(cislo=u.cislo_zadani, deadline__gte=h.reseni.cas_doruceni).first()
|
|
||||||
h.deadline_body = d
|
|
||||||
h.save()
|
|
||||||
continue
|
|
||||||
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
c = p.clanek
|
|
||||||
if c.cislo is not None:
|
|
||||||
d = Deadline.objects.filter(cislo=c.cislo, deadline__gte=h.reseni.cas_doruceni).first()
|
|
||||||
h.deadline_body = d
|
|
||||||
h.save()
|
|
||||||
continue
|
|
||||||
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
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()
|
||||||
|
@ -48,6 +26,33 @@ def prirad_deadliny(apps, schema_editor):
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
cislo = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
u = p.uloha
|
||||||
|
cislo = u.cislo_zadani
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
c = p.clanek
|
||||||
|
if c.cislo is not None:
|
||||||
|
cislo = c.cislo
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if cislo is None:
|
||||||
|
cislo = h.cislo_body
|
||||||
|
|
||||||
|
if cislo is not None:
|
||||||
|
d = Deadline.objects.filter(cislo=cislo, deadline__gte=h.reseni.cas_doruceni).first()
|
||||||
|
if d is None:
|
||||||
|
d = Deadline.objects.filter(cislo=cislo).last()
|
||||||
|
h.deadline_body = d
|
||||||
|
h.save()
|
||||||
|
continue
|
||||||
|
|
||||||
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ší.")
|
||||||
|
|
||||||
d = Deadline.objects.filter(deadline__gte=h.reseni.cas_doruceni).first()
|
d = Deadline.objects.filter(deadline__gte=h.reseni.cas_doruceni).first()
|
||||||
|
|
Loading…
Reference in a new issue