Termínářům se víc hodí čas než počet

This commit is contained in:
Jonas Havelka 2022-02-01 01:03:05 +01:00
parent 653bd98d1b
commit c3f64ab1bf

View file

@ -1,7 +1,7 @@
from django.shortcuts import render
from django.urls import reverse
from django.views import generic
from django.db.models import Q, Count
from django.db.models import Q, Count, Min
from django.views.decorators.debug import sensitive_post_parameters
from django.views.generic.base import TemplateView
from django.contrib.auth.models import User, Permission, Group
@ -52,8 +52,8 @@ class OrgoRozcestnikView(TemplateView):
context['muj_pocet_reseni_mimo_cislo'] = reseni_mimo_cislo.filter(Q(problem__garant=organizator) | Q(problem__autor=organizator) | Q(problem__opravovatele__in=[organizator])).count()
# Termínářský přehled
pocty_neopravenych_reseni = neobodovana_reseni.select_related('problem').values('problem__nazev').annotate(count=Count('problem')).order_by()
context["pocty_neopravenych_reseni"] = [(it['problem__nazev'], it['count']) for it in pocty_neopravenych_reseni.all()]
pocty_neopravenych_reseni = neobodovana_reseni.select_related('problem').values('problem__nazev').annotate(cas=Min('reseni__cas_doruceni')).order_by('cas')
context["pocty_neopravenych_reseni"] = [(it['problem__nazev'], it['cas'].date) for it in pocty_neopravenych_reseni.all()]
#FIXME: přidat stav='STAV_ZADANY'
temata = s.Tema.objects.filter(Q(garant=organizator) | Q(autor=organizator) | Q(opravovatele__in=[organizator]),