Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also set sub_status when giving credit with achievement items (hotfix of #2521) #2525

Merged
Merged
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
3 changes: 2 additions & 1 deletion lib/WeBWorK/AchievementItems/FullCreditProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ 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 of the problem to one.
# Set the status and sub_status of the problem to one.
$problem->status(1);
$problem->sub_status(1);
$db->putUserProblem($problem);

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

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

Expand Down
14 changes: 6 additions & 8 deletions lib/WeBWorK/AchievementItems/HalfCreditProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sub new ($class) {
return bless {
id => 'HalfCreditProb',
name => x('Lesser Rod of Revelation'),
description => x('Gives half credit on a single homework problem.')
description => x('Increases the score of a single problem by 50%, to a maximum of 100%.')
}, $class;
}

Expand Down Expand Up @@ -60,7 +60,7 @@ sub print_form ($self, $sets, $setProblemIds, $c) {
$c->tag(
'p',
$c->maketext(
'Please choose the set name and problem number of the question which should be given half credit.')
'Please choose the assignment name and problem number of the question to add half credit to.')
),
WeBWorK::AchievementItems::form_popup_menu_row(
$c,
Expand Down Expand Up @@ -101,12 +101,10 @@ sub use_item ($self, $userName, $c) {
return 'There was an error accessing that problem.' unless $problem;

# Add .5 to grade with max of 1

if ($problem->status < .5) {
$problem->status($problem->status + .5);
} else {
$problem->status(1);
}
my $new_status = $problem->status + 0.5;
$new_status = 1 if $new_status > 1;
$problem->status($new_status);
$problem->sub_status($new_status);

$db->putUserProblem($problem);

Expand Down
16 changes: 9 additions & 7 deletions lib/WeBWorK/AchievementItems/HalfCreditSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sub new ($class) {
return bless {
id => 'HalfCreditSet',
name => x('Lesser Tome of Enlightenment'),
description => x('Gives half credit on every problem in a set.')
description => x('Increases the score of every problem in an assignment by 50%, to a maximum of 100%.')
}, $class;
}

Expand All @@ -41,7 +41,9 @@ sub print_form ($self, $sets, $setProblemIds, $c) {
return unless @openSets;

return $c->c(
$c->tag('p', $c->maketext('Please choose the set for which all problems should have half credit added.')),
$c->tag(
'p', $c->maketext('Please choose the assignment for which all problems should have half credit added.')
),
WeBWorK::AchievementItems::form_popup_menu_row(
$c,
id => 'hcs_set_id',
Expand Down Expand Up @@ -73,11 +75,11 @@ sub use_item ($self, $userName, $c) {
my $problem = $db->getUserProblem($userName, $setID, $probID);

# Add .5 to grade with max of 1.
if ($problem->status < .5) {
$problem->status($problem->status + .5);
} else {
$problem->status(1);
}
my $new_status = $problem->status + 0.5;
$new_status = 1 if $new_status > 1;
$problem->status($new_status);
$problem->sub_status($new_status);

$db->putUserProblem($problem);
}

Expand Down