Skip to content

Commit 566a6db

Browse files
committed
Don't delete proctor keys for tests with unlimited number of attempts
Currently if a proctored test is set to have an unlimited number of attempts per version, the user clicks to grade the test, and the proctor credentials are validly entered, then if the user tries to move to another page of the test the user is taken to the proctor login page again. This is because of an error in the logic that causes the proctor keys to be deleted instead of the proctor grading key.
1 parent 5af82c6 commit 566a6db

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/WeBWorK/ContentGenerator/GatewayQuiz.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ async sub pre_header_initialize ($c) {
912912

913913
# Save results to database as appropriate
914914
if ($c->{submitAnswers} || (($c->{previewAnswers} || $c->param('newPage')) && $can{recordAnswers})) {
915-
# If answers are being submitted, then save the problems to the database. If this is a preview or pages change
915+
# If answers are being submitted, then save the problems to the database. If this is a preview or page change
916916
# and answers can be recorded, then save the last answer for future reference.
917917
# Also save the persistent data to the database even when the last answer is not saved.
918918

@@ -922,7 +922,9 @@ async sub pre_header_initialize ($c) {
922922
my $proctorID = $c->param('proctor_user');
923923

924924
# If there are no attempts left, delete all proctor keys for this user.
925-
if ($set->attempts_per_version - 1 - $problem->num_correct - $problem->num_incorrect <= 0) {
925+
if ($set->attempts_per_version > 0
926+
&& $set->attempts_per_version - 1 - $problem->num_correct - $problem->num_incorrect <= 0)
927+
{
926928
eval { $db->deleteAllProctorKeys($effectiveUserID); };
927929
} else {
928930
# Otherwise, delete only the grading key.

0 commit comments

Comments
 (0)