Skip to content

Commit

Permalink
Merge pull request openwebwork#2531 from drgrice1/cap-computed-unredu…
Browse files Browse the repository at this point in the history
…ced-score-hotfix

Cap the computed unreduced score at 1. (hotfix of openwebwork#2530)
  • Loading branch information
Alex-Jordan authored Aug 20, 2024
2 parents 310c356 + a94284e commit 6fdc8d9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/WeBWorK/Utils/ProblemProcessing.pm
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,19 @@ sub compute_reduced_score ($ce, $problem, $set, $score, $submitTime) {
# If reduced scoring is enabled for the set and the sub_status is less than the status, then the status is the
# reduced score. In that case compute and return the unreduced score that resulted in that reduced score.
sub compute_unreduced_score ($ce, $problem, $set) {
return
$set->enable_reduced_scoring
if ($set->enable_reduced_scoring
&& $ce->{pg}{ansEvalDefaults}{reducedScoringValue}
&& defined $problem->sub_status && $problem->sub_status < $problem->status
? (($problem->status - $problem->sub_status) / $ce->{pg}{ansEvalDefaults}{reducedScoringValue} +
$problem->sub_status)
: $problem->status;
&& defined $problem->sub_status
&& $problem->sub_status < $problem->status)
{
# Note that if the status has been modified by an instructor using a problem grader or an achivement, then the
# computed unreduced score can be greater than one. So make sure to cap the score.
my $unreducedScore =
($problem->status - $problem->sub_status) / $ce->{pg}{ansEvalDefaults}{reducedScoringValue} +
$problem->sub_status;
return $unreducedScore > 1 ? 1 : $unreducedScore;
}
return $problem->status;
}

# create answer string from responses hash
Expand Down

0 comments on commit 6fdc8d9

Please sign in to comment.