diff --git a/atlas/templates/atlas/collection_case_view_take.html b/atlas/templates/atlas/collection_case_view_take.html
index 856353eb..a1bda017 100644
--- a/atlas/templates/atlas/collection_case_view_take.html
+++ b/atlas/templates/atlas/collection_case_view_take.html
@@ -1,4 +1,5 @@
{% extends 'atlas/base.html' %}
+{% load crispy_forms_tags %}
{% block content %}
Collection: {{collection}}
@@ -218,7 +219,7 @@
{{form.json.errors}}
@@ -345,6 +346,24 @@
// Question time limit countdown + auto-submit
$(function () {
+
+ function lockQuestion() {
+ // Only disable save buttons to prevent further saves
+ $form = $('form.post-form');
+ var $saveBtns = $form.find('button[name="save"], #id_answer');
+ if ($saveBtns.length) {
+ $saveBtns.prop('disabled', true);
+ }
+
+ // Visual feedback: set timer to Locked and progress to red
+ $progressInner = $('#question-timer-progress-inner');
+ $('#question-timer').text('Locked');
+ $progressInner.css('background', '#dc3545');
+ $progressInner.css('width', '0%');
+
+ $("#question-timer-progress-outer").hide();
+ }
+
try {
var timeLimit = {{ collection.question_time_limit|default:'null' }};
var questionCompleted = {{ question_completed|yesno:"true,false" }};
@@ -354,6 +373,15 @@
if (!timeLimit || questionCompleted) {
return;
}
+
+ {% if answer %}
+ if ({{answer.completed|yesno:"true,false"}}) {
+ lockQuestion();
+ console.debug('Timer: answer already completed, aborting timer init');
+ return;
+ }
+ {% endif %}
+
var $timer = $('#question-timer');
var $form = $('form.post-form');
@@ -434,16 +462,7 @@
console.debug('No JSON response from timed_out request', e);
}
- // Only disable save buttons to prevent further saves
- var $saveBtns = $form.find('button[name="save"], #id_answer');
- if ($saveBtns.length) {
- $saveBtns.prop('disabled', true);
- }
-
- // Visual feedback: set timer to Locked and progress to red
- $('#question-timer').text('Locked');
- $progressInner.css('background', '#dc3545');
- $progressInner.css('width', '0%');
+ lockQuestion();
var msg = 'Answer auto-submitted';
if (resp && resp.submitted_at) {
diff --git a/atlas/templates/atlas/collection_history.html b/atlas/templates/atlas/collection_history.html
index 98db9347..dad61929 100644
--- a/atlas/templates/atlas/collection_history.html
+++ b/atlas/templates/atlas/collection_history.html
@@ -34,13 +34,13 @@
{% for cidexam in cidexams %}
-
- {{cidexam.cid_user}}
+ {{cidexam.cid_user}}
Completed: {{cidexam.completed}}
Started: {{cidexam.start_time}}, Ended: {{cidexam.end_time}}