From 3935d609619f8ca65abfd4fd3e9a2d7ea9d4c118 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Sat, 11 Nov 2023 21:20:34 -0800 Subject: [PATCH 1/2] don't assume quiz problem numbers include number 1 --- lib/WeBWorK/ContentGenerator/Hardcopy.pm | 3 ++- lib/WeBWorK/ContentGenerator/LoginProctor.pm | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator/Hardcopy.pm b/lib/WeBWorK/ContentGenerator/Hardcopy.pm index ca1603a9cf..4b61c46b52 100644 --- a/lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ b/lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -407,7 +407,8 @@ sub display_form ($c) { my $the_set_id = $1; my $the_set_version = $2; $mergedSet = $db->getMergedSetVersion($user_id, $the_set_id, $the_set_version); - my $mergedProblem = $db->getMergedProblemVersion($user_id, $the_set_id, $the_set_version, 1); + my $mergedProblem = $db->getMergedProblemVersion($user_id, $the_set_id, $the_set_version, + ($db->listUserProblems($user_id, $the_set_id))[0]); # Get the parameters needed to determine if correct answers may be shown. my $maxAttempts = $mergedSet->attempts_per_version() || 0; diff --git a/lib/WeBWorK/ContentGenerator/LoginProctor.pm b/lib/WeBWorK/ContentGenerator/LoginProctor.pm index 3e305c8063..6efa84e745 100644 --- a/lib/WeBWorK/ContentGenerator/LoginProctor.pm +++ b/lib/WeBWorK/ContentGenerator/LoginProctor.pm @@ -71,7 +71,10 @@ async sub initialize ($c) { $db->getPermissionLevel($userID), $c->{effectiveUser}, $c->stash->{userSet}, - $db->getMergedProblemVersion($effectiveUserID, $c->stash->{setID}, $versionNum, 1) + $db->getMergedProblemVersion( + $effectiveUserID, $c->stash->{setID}, + $versionNum, ($db->listUserProblems($effectiveUserID, $c->stash->{setID}))[0] + ) )) { $c->stash->{userSet}->version_last_attempt_time(int($c->submitTime)); From c0163db6815214abd4a549c069e553cee051e488 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Tue, 14 Nov 2023 11:09:54 -0800 Subject: [PATCH 2/2] use listProblemVersions instead of listUserProblems --- lib/WeBWorK/ContentGenerator/Hardcopy.pm | 2 +- lib/WeBWorK/ContentGenerator/LoginProctor.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator/Hardcopy.pm b/lib/WeBWorK/ContentGenerator/Hardcopy.pm index 4b61c46b52..378a756d12 100644 --- a/lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ b/lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -408,7 +408,7 @@ sub display_form ($c) { my $the_set_version = $2; $mergedSet = $db->getMergedSetVersion($user_id, $the_set_id, $the_set_version); my $mergedProblem = $db->getMergedProblemVersion($user_id, $the_set_id, $the_set_version, - ($db->listUserProblems($user_id, $the_set_id))[0]); + ($db->listProblemVersions($user_id, $the_set_id, $the_set_version))[0]); # Get the parameters needed to determine if correct answers may be shown. my $maxAttempts = $mergedSet->attempts_per_version() || 0; diff --git a/lib/WeBWorK/ContentGenerator/LoginProctor.pm b/lib/WeBWorK/ContentGenerator/LoginProctor.pm index 6efa84e745..efba394bd4 100644 --- a/lib/WeBWorK/ContentGenerator/LoginProctor.pm +++ b/lib/WeBWorK/ContentGenerator/LoginProctor.pm @@ -73,7 +73,7 @@ async sub initialize ($c) { $c->stash->{userSet}, $db->getMergedProblemVersion( $effectiveUserID, $c->stash->{setID}, - $versionNum, ($db->listUserProblems($effectiveUserID, $c->stash->{setID}))[0] + $versionNum, ($db->listProblemVersions($effectiveUserID, $c->stash->{setID}, $versionNum))[0] ) )) {