Skip to content

Commit

Permalink
Fix issue with submissions list count variable
Browse files Browse the repository at this point in the history
Most notably fixes "Show all submissions" button missing.

With the new pseudonymization feature, in exercise/staff_views:ListSubmissionsView,
the submissions queryset is iterated over, resulting in evaluating the queryset,
e.g. it being converted into a list which has no .count() method. Fix by including
the count variable in the template context.
  • Loading branch information
murhum1 committed Apr 22, 2024
1 parent 5eb37ca commit 167ca1c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion exercise/staff_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def get_common_objects(self) -> None:
self.all = self.request.GET.get('all', None)
self.all_url = self.exercise.get_submission_list_url() + "?all=yes"
self.submissions = qs if self.all else qs[:self.default_limit]
self.note("all", "all_url", "submissions", "default_limit")
self.count = len(self.submissions)
self.note("all", "all_url", "submissions", "default_limit", "count")


class SubmissionsSummaryView(ExerciseBaseView):
Expand Down
3 changes: 0 additions & 3 deletions exercise/templates/exercise/staff/_submissions_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{% load course %}
{% load exercise %}
{% load static %}
{% with count=submissions.count %}

<div class="clearfix">
<div class="pull-right">
Expand Down Expand Up @@ -121,5 +120,3 @@
</table>

{% include "exercise/staff/_regrade_submissions.html" %}

{% endwith %}

0 comments on commit 167ca1c

Please sign in to comment.