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 18, 2024
1 parent 14cb8c9 commit 7ac3d8a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
7 changes: 5 additions & 2 deletions lib/WeBWorK/AchievementItems/FullCreditProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ 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 ($problem->enable_reduced_scoring && $problem->reduced_scoring_date < time);

$db->putUserProblem($problem);

$globalData->{ $self->{id} }--;
Expand Down
7 changes: 5 additions & 2 deletions lib/WeBWorK/AchievementItems/FullCreditSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ 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 ($problem->enable_reduced_scoring && $problem->reduced_scoring_date < time);

$db->putUserProblem($problem);
}

Expand Down
4 changes: 3 additions & 1 deletion lib/WeBWorK/AchievementItems/HalfCreditProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ 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 ($problem->enable_reduced_scoring && $problem->reduced_scoring_date < time);
$db->putUserProblem($problem);

$globalData->{ $self->{id} }--;
Expand Down
5 changes: 4 additions & 1 deletion lib/WeBWorK/AchievementItems/HalfCreditSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ 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 ($problem->enable_reduced_scoring && $problem->reduced_scoring_date < time);

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

0 comments on commit 7ac3d8a

Please sign in to comment.