Browse Source

Trocha popisu TabulkaOdevzdanychReseniView, ať se v tom dá vyznat

prehlednejsi_hodnotitko
Pavel "LEdoian" Turinsky 2 years ago
parent
commit
dd5d8886ee
  1. 8
      odevzdavatko/views.py

8
odevzdavatko/views.py

@ -125,7 +125,7 @@ class TabulkaOdevzdanychReseniView(ListView):
ctx = super().get_context_data(*args, **kwargs) ctx = super().get_context_data(*args, **kwargs)
ctx['problemy'] = self.problemy ctx['problemy'] = self.problemy
ctx['resitele'] = self.resitele ctx['resitele'] = self.resitele
tabulka = dict() tabulka: dict[m.Problem, dict[m.Resitel, SouhrnReseni]] = dict()
def pridej_reseni(problem, resitel, body, cas): def pridej_reseni(problem, resitel, body, cas):
if problem not in tabulka: if problem not in tabulka:
@ -145,11 +145,11 @@ class TabulkaOdevzdanychReseniView(ListView):
for resitel in hodnoceni.reseni.resitele.all(): for resitel in hodnoceni.reseni.resitele.all():
pridej_reseni(hodnoceni.problem, resitel, hodnoceni.body, hodnoceni.reseni.cas_doruceni) pridej_reseni(hodnoceni.problem, resitel, hodnoceni.body, hodnoceni.reseni.cas_doruceni)
hodnoty = [] hodnoty: list[list[SouhrnReseni]] = []
resitele_do_tabulky = [] resitele_do_tabulky: list[m.Resitel] = []
for resitel in self.resitele: for resitel in self.resitele:
dostal_body = False dostal_body = False
resiteluv_radek = [] resiteluv_radek: list[SourhnReseni] = [] # podle pořadí v self.problemy, pokud daný problém neřešil, pak None
for problem in self.problemy: for problem in self.problemy:
if problem in tabulka and resitel in tabulka[problem]: if problem in tabulka and resitel in tabulka[problem]:
resiteluv_radek.append(tabulka[problem][resitel]) resiteluv_radek.append(tabulka[problem][resitel])

Loading…
Cancel
Save