From 36c8acbbd6205aba540fbf53bc12f6f7bbab250e Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Tue, 6 Apr 2021 23:33:10 +0200 Subject: [PATCH 1/5] =?UTF-8?q?Odevzd=C3=A1v=C3=A1tko:=20p=C5=99ehled=20?= =?UTF-8?q?=C5=99e=C5=A1en=C3=AD=20pro=20=C5=99e=C5=A1itele=20(o=C5=A1kliv?= =?UTF-8?q?=C3=BD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/urls.py | 1 + seminar/views/odevzdavatko.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/seminar/urls.py b/seminar/urls.py index e5b79e01..5b469170 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -173,4 +173,5 @@ urlpatterns = [ path('temp/reseni/', org_required(viewMethodSwitch(get=views.DetailReseniView.as_view(), post=views.hodnoceniReseniView)), name='odevzdavatko_detail_reseni'), path('temp/reseni/all', org_required(views.SeznamReseniView.as_view())), path('temp/reseni/akt', org_required(views.SeznamAktualnichReseniView.as_view())), + path('temp/reseni/resitel', resitel_required(views.PrehledOdevzdanychReseni.as_view())), ] diff --git a/seminar/views/odevzdavatko.py b/seminar/views/odevzdavatko.py index 3aa7e469..585727a5 100644 --- a/seminar/views/odevzdavatko.py +++ b/seminar/views/odevzdavatko.py @@ -25,6 +25,8 @@ logger = logging.getLogger(__name__) # - ReseniProblemuView # - Detail konkrétního řešení -- všechny soubory, datum, ... # - DetailReseniView +# - Pro řešitele: přehled jejich odevzdaných řešení +# - PrehledOdevzdanychReseni # # Taky se může hodit: # - Tabulka všech řešitelů x všech problémů? @@ -238,6 +240,29 @@ def hodnoceniReseniView(request, pk, *args, **kwargs): return redirect(success_url) +class PrehledOdevzdanychReseni(ListView): + model = m.Hodnoceni + template_name = 'seminar/odevzdavatko/resitel_prehled.html' + + def get_queryset(self): + if not self.request.user.is_authenticated: + raise RuntimeError("Uživatel měl být přihlášený!") + resitel = m.Resitel.objects.get(osoba__user=self.request.user) + qs = super().get_queryset() + qs = qs.filter(reseni__resitele__in=[resitel]) + return qs + + def get_context_data(self, *args, **kwargs): + ctx = super().get_context_data(*args, **kwargs) + # Ročník určujeme podle čísla, do jehož deadlinu došlo řešení. + # Chceme to mít seřazené, takže místo comphrerehsion ručně postavíme pole polí. Django templates neumí použít OrderedDict :-/ + podle_rocniku = [] + for rocnik, hodnoceni in groupby(ctx['object_list'], lambda ho: deadline(ho.reseni.cas_doruceni)[1].rocnik): + podle_rocniku.append((rocnik, list(hodnoceni))) + ctx['podle_rocniku'] = reversed(podle_rocniku) # Od nejnovějšího ročníku + # TODO: Umožnit stažení / zobrazení řešení + return ctx + # Přehled všech řešení kvůli debugování class SeznamReseniView(ListView): From 757d3189e70950081cfd9f1f8540e750f7841a28 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Tue, 13 Apr 2021 23:06:50 +0200 Subject: [PATCH 2/5] =?UTF-8?q?Template=20pro=20p=C5=99ehled=20poslan?= =?UTF-8?q?=C3=BDch=20=C5=99e=C5=A1en=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../seminar/odevzdavatko/resitel_prehled.html | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 seminar/templates/seminar/odevzdavatko/resitel_prehled.html diff --git a/seminar/templates/seminar/odevzdavatko/resitel_prehled.html b/seminar/templates/seminar/odevzdavatko/resitel_prehled.html new file mode 100644 index 00000000..43a95d95 --- /dev/null +++ b/seminar/templates/seminar/odevzdavatko/resitel_prehled.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} +{% load static %} +{% load deadliny %} + +{% block content %} +{% for rocnik, hodnoceni in podle_rocniku %} +

Ročník {{ rocnik }}

+ + + + + + + + {% for hodn in hodnoceni %} + + + + + + + {% endfor %} +
DoručenoProblémBodyDeadline
{{ hodn.reseni.cas_doruceni }}{{ hodn.problem }}{{ hodn.body|default_if_none:"---" }}{{ hodn.reseni.cas_doruceni | deadline_html }}
+{% endfor %} +{% endblock %} From adef6c662718eb6eab480af9409a0749fd21bb7b Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Wed, 14 Apr 2021 01:11:51 +0200 Subject: [PATCH 3/5] =?UTF-8?q?Styl=20p=C5=99ehledu=20=C5=99e=C5=A1en?= =?UTF-8?q?=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../seminar/odevzdavatko/resitel_prehled.html | 15 ++++++++++++++- seminar/templatetags/deadliny.py | 12 +++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/seminar/templates/seminar/odevzdavatko/resitel_prehled.html b/seminar/templates/seminar/odevzdavatko/resitel_prehled.html index 43a95d95..be2e94bd 100644 --- a/seminar/templates/seminar/odevzdavatko/resitel_prehled.html +++ b/seminar/templates/seminar/odevzdavatko/resitel_prehled.html @@ -2,10 +2,23 @@ {% load static %} {% load deadliny %} +{% block custom_css %} + +{% endblock custom_css %} + {% block content %} {% for rocnik, hodnoceni in podle_rocniku %}

Ročník {{ rocnik }}

- +
diff --git a/seminar/templatetags/deadliny.py b/seminar/templatetags/deadliny.py index b7a0142d..81500d73 100644 --- a/seminar/templatetags/deadliny.py +++ b/seminar/templatetags/deadliny.py @@ -13,10 +13,20 @@ def deadline_text(datum): } return strings[typ] +@register.filter(name='deadline_kratseji') +def deadline_kratsi_text(datum): + typ, cislo, dl = deadline(datum) + strings = { + TypDeadline.PredDeadline: f"1. deadline {cislo}", + TypDeadline.SousDeadline: f"Soustřeďkový deadline {cislo}", + TypDeadline.FinalDeadline: f"Finální deadline {cislo}", + } + return strings[typ] + @register.filter(name='deadline_html') def deadline_html(datum): typ, _, _ = deadline(datum) - text = deadline_text(datum) + text = deadline_kratsi_text(datum) classes = { TypDeadline.PredDeadline: 'preddeadline', TypDeadline.SousDeadline: 'sous_deadline', From fdac1a643dc6c5c4ebdd4df1ae74b0374a679a07 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Wed, 14 Apr 2021 01:29:29 +0200 Subject: [PATCH 4/5] =?UTF-8?q?Odkazy=20na=20p=C5=99ehled=20odevzdan=C3=BD?= =?UTF-8?q?ch=20=C5=99e=C5=A1en=C3=AD=20z=20profilu=20a=20z=20men=C3=AD?= =?UTF-8?q?=C4=8Dka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + lepší URL --- data/sitetree.json | 32 +++++++++++++++++-- seminar/templates/seminar/profil/resitel.html | 1 + seminar/urls.py | 2 +- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/data/sitetree.json b/data/sitetree.json index 26c70ca3..2c1b1a65 100644 --- a/data/sitetree.json +++ b/data/sitetree.json @@ -700,8 +700,8 @@ "inmenu": true, "insitetree": true, "parent": 21, - "sort_order": 37, - "title": "Odevzdaná řešení", + "sort_order": 38, + "title": "Došlá řešení", "tree": 1, "url": "odevzdavatko_tabulka", "urlaspattern": true @@ -724,7 +724,7 @@ "inmenu": true, "insitetree": true, "parent": 21, - "sort_order": 38, + "sort_order": 42, "title": "Odhlásit se", "tree": 1, "url": "logout", @@ -806,5 +806,31 @@ }, "model": "sitetree.treeitem", "pk": 41 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [ + 2 + ], + "access_restricted": true, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 21, + "sort_order": 37, + "title": "Odevzdaná řešení", + "tree": 1, + "url": "seminar_resitel_odevzdana_reseni", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 42 } ] \ No newline at end of file diff --git a/seminar/templates/seminar/profil/resitel.html b/seminar/templates/seminar/profil/resitel.html index 8f29d246..364bd541 100644 --- a/seminar/templates/seminar/profil/resitel.html +++ b/seminar/templates/seminar/profil/resitel.html @@ -11,6 +11,7 @@ Odhlásit se
Upravit údaje
+Odevzdaná řešení
{% endblock %} diff --git a/seminar/urls.py b/seminar/urls.py index 5b469170..8ee67404 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -135,6 +135,7 @@ urlpatterns = [ path('prihlasit/', views.LoginView.as_view(), name='login'), path('odhlasit/', views.LogoutView.as_view(), name='logout'), path('resitel/', resitel_required(views.ResitelView.as_view()), name='seminar_resitel'), + path('resitel/odevzdana_reseni/', resitel_required(views.PrehledOdevzdanychReseni.as_view()), name='seminar_resitel_odevzdana_reseni'), path('reset-hesla/', views.PasswordResetView.as_view(), name='reset_password'), path('zmena-hesla/', views.PasswordChangeView.as_view(), name='change_password'), path('reset-hesla/2/', views.PasswordResetDoneView.as_view(), name='reset_password_done'), @@ -173,5 +174,4 @@ urlpatterns = [ path('temp/reseni/', org_required(viewMethodSwitch(get=views.DetailReseniView.as_view(), post=views.hodnoceniReseniView)), name='odevzdavatko_detail_reseni'), path('temp/reseni/all', org_required(views.SeznamReseniView.as_view())), path('temp/reseni/akt', org_required(views.SeznamAktualnichReseniView.as_view())), - path('temp/reseni/resitel', resitel_required(views.PrehledOdevzdanychReseni.as_view())), ] From 4b9168c918f74a46716d5f06291c5d6a9585adc2 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Wed, 14 Apr 2021 01:30:54 +0200 Subject: [PATCH 5/5] =?UTF-8?q?Men=C3=AD=C4=8Dko:=20Hinty=20ohledn=C4=9B?= =?UTF-8?q?=20doru=C4=8Den=C3=BDch=20a=20odeslan=C3=BDch=20=C5=99e=C5=A1en?= =?UTF-8?q?=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Zobrazují se po najetí myší, což je nerušivé ale potenciálně užitečné --- data/sitetree.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/sitetree.json b/data/sitetree.json index 2c1b1a65..b910e5be 100644 --- a/data/sitetree.json +++ b/data/sitetree.json @@ -695,7 +695,7 @@ "alias": null, "description": "", "hidden": false, - "hint": "", + "hint": "To, co ŘEŠITELÉ poslali", "inbreadcrumbs": true, "inmenu": true, "insitetree": true, @@ -819,7 +819,7 @@ "alias": null, "description": "", "hidden": false, - "hint": "", + "hint": "To, co jsem JÁ odevzdal", "inbreadcrumbs": true, "inmenu": true, "insitetree": true,
Doručeno Problém