Skip to content

Commit

Permalink
Only update sub_status outside of reduced scoring in achievement items.
Browse files Browse the repository at this point in the history
  • Loading branch information
somiaj committed Aug 19, 2024
1 parent 592eb2c commit 311a2bf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
10 changes: 8 additions & 2 deletions lib/WeBWorK/AchievementItems/FullCreditProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,15 @@ sub use_item ($self, $userName, $c) {
my $problem = $db->getUserProblem($userName, $setID, $problemID);
return 'There was an error accessing that problem.' unless $problem;

# Set the status and sub_status of the problem to one.
# Set the status of the problem to one.
$problem->status(1);
$problem->sub_status(1);

# Update the sub_status unless inside the reduced scoring period.
$problem->sub_status(1)
unless ($ce->{pg}{ansEvalDefaults}{enableReducedScoring}
&& $problem->enable_reduced_scoring
&& $problem->reduced_scoring_date < time);

$db->putUserProblem($problem);

$globalData->{ $self->{id} }--;
Expand Down
10 changes: 8 additions & 2 deletions lib/WeBWorK/AchievementItems/FullCreditSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,15 @@ sub use_item ($self, $userName, $c) {
for my $probID (@probIDs) {
my $problem = $db->getUserProblem($userName, $setID, $probID);

# Set status and sub_status to 1.
# Set status to 1.
$problem->status(1);
$problem->sub_status(1);

# Update the sub_status unless inside the reduced scoring period.
$problem->sub_status(1)
unless ($ce->{pg}{ansEvalDefaults}{enableReducedScoring}
&& $problem->enable_reduced_scoring
&& $problem->reduced_scoring_date < time);

$db->putUserProblem($problem);
}

Expand Down
6 changes: 5 additions & 1 deletion lib/WeBWorK/AchievementItems/HalfCreditProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ sub use_item ($self, $userName, $c) {
my $new_status = $problem->status + 0.5;
$new_status = 1 if $new_status > 1;
$problem->status($new_status);
$problem->sub_status($new_status);

# Update the sub_status unless inside the reduced scoring period.
$problem->sub_status($new_status)
unless ($ce->{pg}{ansEvalDefaults}{enableReducedScoring}
&& $problem->enable_reduced_scoring
&& $problem->reduced_scoring_date < time);
$db->putUserProblem($problem);

$globalData->{ $self->{id} }--;
Expand Down
7 changes: 6 additions & 1 deletion lib/WeBWorK/AchievementItems/HalfCreditSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ sub use_item ($self, $userName, $c) {
my $new_status = $problem->status + 0.5;
$new_status = 1 if $new_status > 1;
$problem->status($new_status);
$problem->sub_status($new_status);

# Update the sub_status unless inside the reduced scoring period.
$problem->sub_status($new_status)
unless ($ce->{pg}{ansEvalDefaults}{enableReducedScoring}
&& $problem->enable_reduced_scoring
&& $problem->reduced_scoring_date < time);

$db->putUserProblem($problem);
}
Expand Down

0 comments on commit 311a2bf

Please sign in to comment.