From 727dbb1b5f3f20b6cb3804b0bd077df6f8fb35c9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 20:34:42 +0000 Subject: [PATCH 1/2] List flow rule exceptions on gradebook-single with deactivate support Co-authored-by: inducer <352067+inducer@users.noreply.github.com> --- course/grades.py | 12 ++ course/templates/course/gradebook-single.html | 60 +++++++ course/views.py | 33 ++++ relate/urls.py | 8 + tests/test_grades/test_grades.py | 147 ++++++++++++++++++ 5 files changed, 260 insertions(+) diff --git a/course/grades.py b/course/grades.py index c8b1d0f9b..51bf1c855 100644 --- a/course/grades.py +++ b/course/grades.py @@ -55,6 +55,7 @@ from course.flow import adjust_flow_session_page_data from course.models import ( FlowPageVisit, + FlowRuleException, FlowSession, GradeChange, GradeStateMachine, @@ -1045,6 +1046,16 @@ def view_single_grade(pctx: CoursePageContext, participation_id: str, # }}} + flow_rule_exceptions: list[FlowRuleException] | None = None + if show_privileged_info and opportunity.flow_id: + flow_rule_exceptions = list( + FlowRuleException.objects + .filter( + participation=participation, + flow_id=opportunity.flow_id) + .order_by("creation_time") + .select_related("creator")) + return render_course_page(pctx, "course/gradebook-single.html", { "opportunity": opportunity, "avg_grade_percentage": avg_grade_percentage, @@ -1061,6 +1072,7 @@ def view_single_grade(pctx: CoursePageContext, participation_id: str, or PPerm.end_flow_session or PPerm.regrade_flow_session or PPerm.recalculate_flow_session_grade), + "flow_rule_exceptions": flow_rule_exceptions, }) # }}} diff --git a/course/templates/course/gradebook-single.html b/course/templates/course/gradebook-single.html index 95186675b..b3cc41940 100644 --- a/course/templates/course/gradebook-single.html +++ b/course/templates/course/gradebook-single.html @@ -344,6 +344,66 @@
{% trans "(no exceptions)" %}
+ {% else %} +| {% trans "Kind" %} | +{% trans "Created" %} | +{% trans "Creator" %} | +{% trans "Expiration" %} | +{% trans "Comment" %} | +{% trans "Active" %} | + {% if pperm.grant_exception %} +{% trans "Actions" %} | + {% endif %} +
|---|---|---|---|---|---|---|
|
+ {% if not exc.active %} |
+ {{ exc.creation_time }} | +{% if exc.creator %}{{ exc.creator.username }}{% else %}{% trans "(none)" %}{% endif %} | +{% if exc.expiration %}{{ exc.expiration }}{% else %}{% trans "(none)" %}{% endif %} | +{% if exc.comment %}{{ exc.comment }}{% endif %} | ++ {% if exc.active %} + {% trans "Yes" %} + {% else %} + {% trans "No" %} + {% endif %} + | + {% if pperm.grant_exception %} ++ {% if exc.active %} + + {% endif %} + | + {% endif %} +