From 8671822ca0cad3de1a4f1af3d4908ea343938e83 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Sat, 12 Nov 2016 14:00:49 +0100 Subject: [PATCH] Razeni lidi podle poctu korektur. --- korektury/templates/korektury/opraf.html | 4 ++-- korektury/views.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index 6a92f28c..fddf1e0c 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -83,8 +83,8 @@

Děkujeme opravovatelům: - {% for autor,pocet in zasluhy.items %} - {{autor}} ({{pocet}}){% if not forloop.last %},{% endif %} + {% for z in zasluhy %} + {{z.autor}} ({{z.pocet}}){% if not forloop.last %},{% endif %} {% endfor %}


diff --git a/korektury/views.py b/korektury/views.py index 70cfaf6e..6562f8fd 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -184,6 +184,8 @@ class KorekturyView(generic.TemplateView): zasluhy[k.autor]+=1 else: zasluhy[k.autor]=1 + zasluhy = [{'autor':jmeno, 'pocet':pocet} for (jmeno,pocet) in zasluhy.items()] + zasluhy.sort(key=lambda z:z['pocet'],reverse=True) strany = set(o.strana for o in opravy) opravy_na_stranu = [{'strana': s, 'op_id': opravy.filter(strana=s)} for s in strany]