diff --git a/generic/templates/generic/partials/_exam_scores_stats.html b/generic/templates/generic/partials/_exam_scores_stats.html index 6320a29b..63e66702 100644 --- a/generic/templates/generic/partials/_exam_scores_stats.html +++ b/generic/templates/generic/partials/_exam_scores_stats.html @@ -63,9 +63,8 @@ {% if plot %}
-
+
Distribution of Scores
- low scores (<20% max) excluded from statistics
diff --git a/generic/views.py b/generic/views.py index 8e55acb6..10fab976 100644 --- a/generic/views.py +++ b/generic/views.py @@ -4066,10 +4066,6 @@ class ExamViews(View, LoginRequiredMixin): pass_rate = 0.0 if len(user_scores_list) >= 1: - lower_score_bound = max_score / 5 - bounded_scores = [i for i in user_scores_list if i > lower_score_bound] - if bounded_scores: - user_scores_list = bounded_scores mean = round(statistics.mean(user_scores_list), 2) median = round(statistics.median(user_scores_list), 2) @@ -4248,12 +4244,14 @@ class ExamViews(View, LoginRequiredMixin): exam.save() from django.urls import reverse - from django.http import HttpResponseRedirect url = reverse(f"{self.app_name}:exam_scores_all", kwargs={"pk": pk}) - response = HttpResponseRedirect(url) if request.htmx: - response["HX-Redirect"] = url - return response + # Return 200 OK with HX-Redirect header to trigger client-side redirect in HTMX + return HttpResponse("", headers={"HX-Redirect": url}) + + # Standard non-HTMX redirect + from django.http import HttpResponseRedirect + return HttpResponseRedirect(url) def toggle_candidate_stats_exclusion(self, request, pk): exam = get_object_or_404(self.Exam, pk=pk) diff --git a/rad/settings.py b/rad/settings.py index 0e50451d..71cc1f5c 100644 --- a/rad/settings.py +++ b/rad/settings.py @@ -417,6 +417,21 @@ CHANNEL_LAYERS = { }, } +def show_toolbar(request): + if request.headers.get("HX-Request") or getattr(request, "htmx", False): + return False + if request.headers.get("x-requested-with") == "XMLHttpRequest": + return False + try: + from debug_toolbar.middleware import show_toolbar as default_show_toolbar + return default_show_toolbar(request) + except ImportError: + return False + +DEBUG_TOOLBAR_CONFIG = { + "SHOW_TOOLBAR_CALLBACK": "rad.settings.show_toolbar", +} + try: from .settings_local import * except ImportError as e: