Skip to content

Commit

Permalink
simplify check if gateway set has been attempted
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Jordan committed Nov 9, 2024
1 parent bfda906 commit 26946c7
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/WeBWorK/Utils/Sets.pm
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,9 @@ sub gateway_attempted ($db, $setName, $studentName) {

# if there is one version, check for an attempted problem
if (@versionNums) {
my $versionedSet = $db->getSetVersion($studentName, $setName, $versionNums[0]);

my @problemRecords =
$db->getAllMergedProblemVersions($studentName, $versionedSet->set_id, $versionedSet->version_id);
for my $problemRecord (@problemRecords) {
return 1 if $problemRecord->attempted;
}
my @problemNums = $db->listUserProblems($studentName, $setName);
my $problem = $db->getMergedProblemVersion($studentName, $setName, $versionNums[0], $problemNums[0]);
return defined $problem ? $problem->attempted : 0;
}

return 0;
Expand Down

0 comments on commit 26946c7

Please sign in to comment.