Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/WeBWorK/Authen/LTIAdvantage/SubmitGrade.pm
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ async sub submit_grade ($self, $LMSuserID, $lineitem, $scoreGiven, $scoreMaximum
return 1;
}

$self->warning(join("\n", 'Failed to send grade:', $response->message));
$self->warning(join("\n", 'Failed to send grade:', $response->body));
return 0;
}

Expand Down
17 changes: 14 additions & 3 deletions lib/WeBWorK/Utils/Sets.pm
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,21 @@ sub grade_set ($db, $set, $studentName, $setIsVersioned = 0, $wantProblemDetails
}

sub grade_gateway ($db, $setName, $studentName) {
my $bestSetData = [ 0, 0, [] ];
my $bestSetData;

my @setVersions = $db->getSetVersionsWhere({ user_id => $studentName, set_id => $setName });
for (@setVersions) {
my @setData = grade_set($db, $_, $studentName, 1);
$bestSetData = \@setData if $setData[0] > $bestSetData->[0];
$bestSetData = \@setData if !$bestSetData || $setData[0] > $bestSetData->[0];
}

# If the student has not started the test, then the total is still needed for a score of zero out of that total.
unless ($bestSetData) {
my $total = 0;
for ($db->getAllMergedUserProblems($studentName, $setName)) {
$total += defined $_->value && $_->value ne '' ? $_->value : 1;
}
$bestSetData = [ 0, $total, [] ];
}

return wantarray ? (@$bestSetData, \@setVersions) : ($bestSetData->[1] ? $bestSetData->[0] / $bestSetData->[1] : 0);
Expand Down Expand Up @@ -327,7 +336,9 @@ In list context this returns a list of the total number of correct problems for
the highest scoring version of this test, the total number of problems in that
version, a reference to an array of merged user problem records from that
version, and a reference to an array of merged user set versions for this user
and set.
and set. If the user has no versions of the test, then the total is computed
from the problems assigned to the user for the test, and the array of problem
records is empty.

In scalar context this returns the percentage correct for the highest scoring
version of this test.
Expand Down