diff --git a/course/templatetags/course.py b/course/templatetags/course.py index d1481cd4f..5f66f02be 100644 --- a/course/templatetags/course.py +++ b/course/templatetags/course.py @@ -1,4 +1,5 @@ from typing import Any, Dict, List, Union +from copy import copy from django import template from django.db import models @@ -22,6 +23,10 @@ def _prepare_topmenu(context): return context['topmenu'] +def _deadline_extended_exercise_open(entry, now): + personal_deadline = entry.get('personal_deadline') + return personal_deadline is not None and entry['opening_time'] <= now <= personal_deadline + @register.inclusion_tag("course/_course_dropdown_menu.html", takes_context=True) def course_menu(context): menu = _prepare_topmenu(context) @@ -87,6 +92,17 @@ def exercises_open(entry, now): return entry['opening_time'] <= now <= entry['closing_time'] +@register.filter +def deadline_extended_exercise_open(entry, now): + return _deadline_extended_exercise_open(entry, now) + + +@register.filter +def deadline_extended_exercises_open(entry, now): + entries = copy(entry['flatted']) + return any(_deadline_extended_exercise_open(entry, now) for entry in entries) + + @register.filter def exercises_submittable(entry, now): if entry['late_allowed']: diff --git a/exercise/templates/exercise/_user_results.html b/exercise/templates/exercise/_user_results.html index 820165758..1bbaac8bd 100644 --- a/exercise/templates/exercise/_user_results.html +++ b/exercise/templates/exercise/_user_results.html @@ -46,6 +46,11 @@

{% translate "OPEN_FOR_READING" %} {% endif %} + {% if module|deadline_extended_exercises_open:now %} + + {% translate "SOME_EXERCISES_WITH_EXTENDED_DEADLINES" %} + + {% endif %} {% if module.requirements|length > 0 %} {% translate "REQUIRES" %}: @@ -113,6 +118,14 @@

{% if exercise_accessible or is_course_staff %} {{ entry.name|parse_localization }} + {% if entry|deadline_extended_exercise_open:now %} + + + + {% endif %} {% else %} {{ entry.name|parse_localization }} {% endif %} diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index 331c19f89..550d865ed 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-14 14:12+0300\n" +"POT-Creation-Date: 2023-07-18 16:43+0300\n" "PO-Revision-Date: 2021-05-27 14:47+0300\n" "Last-Translator: Jimmy Ihalainen \n" "Language-Team: English<>\n" @@ -3824,6 +3824,7 @@ msgid "POINTS_REQUIRED_TO_PASS" msgstr "Points required to pass" #: exercise/templates/exercise/_exercise_info.html +#: exercise/templates/exercise/_user_results.html #: exercise/templates/exercise/exercise_plain.html msgid "EXTENDED_DEADLINE" msgstr "Extended deadline" @@ -4026,6 +4027,10 @@ msgstr "Exercises open on" msgid "OPEN_FOR_READING" msgstr "Open for reading" +#: exercise/templates/exercise/_user_results.html +msgid "SOME_EXERCISES_WITH_EXTENDED_DEADLINES" +msgstr "Some assignments have extended deadlines" + #: exercise/templates/exercise/_user_results.html #: exercise/templates/exercise/_user_toc.html #: lti_tool/templates/lti_tool/lti_course.html diff --git a/locale/fi/LC_MESSAGES/django.po b/locale/fi/LC_MESSAGES/django.po index 4fe9cacfc..92a88fa45 100644 --- a/locale/fi/LC_MESSAGES/django.po +++ b/locale/fi/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-14 14:12+0300\n" +"POT-Creation-Date: 2023-07-18 16:43+0300\n" "PO-Revision-Date: 2019-08-14 12:16+0200\n" "Last-Translator: Jimmy Ihalainen \n" "Language-Team: Finnish <>\n" @@ -3831,6 +3831,7 @@ msgid "POINTS_REQUIRED_TO_PASS" msgstr "Pistevaatimus" #: exercise/templates/exercise/_exercise_info.html +#: exercise/templates/exercise/_user_results.html #: exercise/templates/exercise/exercise_plain.html msgid "EXTENDED_DEADLINE" msgstr "Pidennetty määräaika" @@ -4036,6 +4037,10 @@ msgstr "Tehtävät avautuvat" msgid "OPEN_FOR_READING" msgstr "Lukumateriaali avoinna" +#: exercise/templates/exercise/_user_results.html +msgid "SOME_EXERCISES_WITH_EXTENDED_DEADLINES" +msgstr "Joillain tehtävillä pidennetty määräaika" + #: exercise/templates/exercise/_user_results.html #: exercise/templates/exercise/_user_toc.html #: lti_tool/templates/lti_tool/lti_course.html