Repository navigation
Conversation
drgrice1
force-pushed
the
test-resubmit-protect
branch
from
October 27, 2026 21:09
1cc284f to
d8c2701
Compare
If a test submission is slow (for example on a bad connection), then the
student can submit the test again while the first submission is still
being graded. Since the number of attempts is not saved until grading is
complete, both submissions were graded as the same attempt, and the one
that finished last overwrote the scores of the other. This happened even
for tests that allow only one submission per version.
The gateway form now only allows one submission. On the server, the
version_last_attempt_time and number of attempts used when the page was
rendered are included in the form. A submission is not graded if the
number of attempts has changed. Otherwise the submission time is saved
with a conditional database update that only succeeds if
version_last_attempt_time is unchanged (the new value is always later
than the old one, so that two submissions can not both succeed). The
proctor login page saves the time in the same way and forwards the new
value. Finally, before any scores are saved, the new number of attempts
for one problem is saved with a conditional database update that only
succeeds if that number is unchanged. That catches a submission from a
page rendered while another submission was being graded.
To reproduce the issues, make a test with the following problem and at
least one other problem, set "Graded submissions per version" to 1
(except as noted), and assign it to a student. Grading the problem takes
10 seconds, which leaves time to submit again during grading.
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl');
if ($inputs_ref->{submitAnswers}) {
my $start = time;
1 while time - $start < 10;
}
BEGIN_PGML
What is [`1 + 1`]? [_]{2}
END_PGML
ENDDOCUMENT();
In each case below, before this change both submissions are recorded and
the last to finish overwrites the scores of the other. With this change
only the first submission is recorded.
1. Answer all problems, click "Grade Test" and "Yes", and then click
"Grade Test" again within 10 seconds.
2. Set the test to show one problem per page. Answer the first problem,
click "Next Problem", answer the second problem, and click "Grade
Test" on that page. Within 10 seconds, click the back button and
click "Grade Test" again. The page that the back button returns to
does not have the answer to the second problem, so before this change
that answer is lost and the problem is scored as unanswered (the
answer log shows both submissions). Grading an older copy of the test
that is open in another tab is the same.
3. Answer all problems, grade the test, reload the page (F5) within 10
seconds, change an answer, and grade the test again.
4. With "Graded submissions per version" set to 2, repeat 2 but wait for
the results before clicking the back button. Before this change, the
submission from the old page is graded as the second attempt. With
this change it is not graded.
5. Change the test to a proctored test that requires proctor
authorization to grade, and repeat 1 and 2, authorizing each
submission with a proctor account. Also click the proctor login
button twice for one submission. Only one submission is graded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drgrice1
force-pushed
the
test-resubmit-protect
branch
from
October 30, 2026 20:38
d8c2701 to
a3e2392
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a test submission is slow (for example on a bad connection), then the student can submit the test again while the first submission is still being graded. Since the number of attempts is not saved until grading is complete, both submissions were graded as the same attempt, and the one that finished last overwrote the scores of the other. This happened even for tests that allow only one submission per version.
The gateway form now only allows one submission. On the server, the version_last_attempt_time and number of attempts used when the page was rendered are included in the form. A submission is not graded if the number of attempts has changed. Otherwise the submission time is saved with a conditional database update that only succeeds if version_last_attempt_time is unchanged (the new value is always later than the old one, so that two submissions can not both succeed). The proctor login page saves the time in the same way and forwards the new value. Finally, before any scores are saved, the new number of attempts for one problem is saved with a conditional database update that only succeeds if that number is unchanged. That catches a submission from a page rendered while another submission was being graded.
To reproduce the issues, make a test with the following problem and at least one other problem, set "Graded submissions per version" to 1 (except as noted), and assign it to a student. Grading the problem takes 10 seconds, which leaves time to submit again during grading.
In each case below, before this change both submissions are recorded and the last to finish overwrites the scores of the other. With this change only the first submission is recorded.
Answer all problems, click "Grade Test" and "Yes", and then click "Grade Test" again within 10 seconds.
Set the test to show one problem per page. Answer the first problem, click "Next Problem", answer the second problem, and click "Grade Test" on that page. Within 10 seconds, click the back button and click "Grade Test" again. The page that the back button returns to does not have the answer to the second problem, so before this change that answer is lost and the problem is scored as unanswered (the answer log shows both submissions). Grading an older copy of the test that is open in another tab is the same.
Answer all problems, grade the test, reload the page (F5) within 10 seconds, change an answer, and grade the test again.
With "Graded submissions per version" set to 2, repeat 2 but wait for the results before clicking the back button. Before this change, the submission from the old page is graded as the second attempt. With this change it is not graded.
Change the test to a proctored test that requires proctor authorization to grade, and repeat 1 and 2, authorizing each submission with a proctor account. Also click the proctor login button twice for one submission. Only one submission is graded.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com