Skip to content

Commit 47e336b

Browse files
committed
Don't show "Review this attempt" when review is not allowed
Somehow, the logic about showing the "Review this attempt" button on the student's attempts listing disappeared, allowing them to review attempts before the "allow review from" date. This commit also makes the RunAttemptView throw a "permission denied" error when a student tries to review an attempt but it's not allowed.
1 parent 485c14c commit 47e336b

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

numbas_lti/templates/numbas_lti/show_attempts.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ <h1>
8787
</td>
8888
<td>
8989
{% if attempt.completed %}
90+
{% if review_allowed %}
9091
<a title="{% blocktranslate with start_time=attempt.start_time %}Review attempt started at {{start_time}}{% endblocktranslate %}" class="button info" href="{% url_with_lti 'run_attempt' pk=attempt.pk %}">
9192
{% icon 'play' %} {% translate "Review this attempt" %}
9293
</a>
94+
{% endif %}
9395

9496
{% if attempt.student_can_reopen %}
9597
<form action="{% url_with_lti 'reopen_attempt' attempt.pk %}" method="POST">

numbas_lti/views/attempt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ def get_mode(self):
269269
raise PermissionDenied(gettext("You're not allowed to review this attempt."))
270270

271271
if attempt.completed():
272+
if not attempt.review_allowed():
273+
raise PermissionDenied(gettext("You're not allowed to review this attempt."))
272274
return 'review'
273275
else:
274276
return 'normal'

0 commit comments

Comments
 (0)