Repository: apluslms/a-plus

Issue:
Display personal deadline extensions on a student’s points page
A student’s points page in A+ just shows the official deadlines for each module. Personalized deadlines are not shown. This has repeatedly caused confusion when a student believes there’s something wrong with their personalized deadline. It would be better if the student was able to see the actual deadlines on their points page (and possibly elsewhere?). 

This would also eliminate some confusion in communications between members of course staff, as staff members would also easily see the student’s DL extensions. 

I’m not sure off the top of my head how best to display this on the page.






Discussion:
I'm thinking we could either add a text below the opening and closing times that says something like "Your deadline is <personal deadline>" similarly to the late submission text:
![image](https://github.com/apluslms/a-plus/assets/49596400/eed6d0e8-2ee3-497b-b163-283195e7606b)
or we could replace the module closing time with the personal deadline and mark it as having been changed. We could add a warning icon or a question mark with a black background next to the date, and have an explanation of the actual deadline vs the personalized deadline in a tooltip that appears when hovering over the deadline.
@lainets note that normal deadlines and late submission deadline apply to the whole module, while personal deadline extensions (deviations) are granted for each assignment separately. The student may then have different deadlines in each assignment within the module, for example, only one assignment might have a deviation and the others use the normal deadline.

It is still possible to add text like "you have deadline extensions in some assignments" to the module heading, and then the assignment rows in the module table would need some symbols to identify the extended assignment deadlines (each row separately since one extended deadline applies to only one assignment).
For some reason I thought that you could apply deviations at the module level when in actuality it adds a deviation for each exercise and that this issue was talking about such deviations. My bad.

Yes, a short text about having deviations would be good, and I'd also want some kind of alert indicator next to the closing time of the module for clarity. We could either have the deviations as a tooltip on that indicator or have similar indicator next to each exercise name with the deviation in the tooltip. I don't think there is a good way to fully write out the deviation in the list due to space constraints.

Resolving patch:
diff --git a/course/templatetags/course.py b/course/templatetags/course.py
--- a/course/templatetags/course.py
+++ b/course/templatetags/course.py
@@ -1,4 +1,5 @@
 from typing import Any, Dict, List, Union
+from copy import deepcopy
 
 from django import template
 from django.db import models
@@ -22,6 +23,11 @@ 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 +93,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 = deepcopy(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']:


Test patch: