Opraveno poradi vysledkovky

This commit is contained in:
Tomas Gavenciak 2015-05-17 06:30:53 +02:00
parent 51f3b22f09
commit 8cc0cf62d0

View file

@ -29,10 +29,10 @@ class CisloView(generic.DetailView):
def get_context_data(self, **kwargs):
context = super(CisloView, self).get_context_data(**kwargs)
vysledky = VysledkyKCislu.objects.filter(cislo = context['cislo']).select_related("resitel")
vysledky = VysledkyKCislu.objects.filter(cislo = context['cislo']).order_by('-body_celkem').select_related("resitel")
reseni = Reseni.objects.filter(cislo_body = context['cislo']).select_related("resitel")
problemy = sorted(list(set([r.problem for r in reseni])), key=lambda x:x.kod)
problemy = sorted(list(set([r.problem for r in reseni])), key=lambda x:(0 if x.typ==Problem.TYP_ULOHA else 1,x.kod))
problem_index = {}
for i in range(len(problemy)):
problem_index[problemy[i].id] = i