Skip to content

Commit

Permalink
Updates to achievement items from feedback.
Browse files Browse the repository at this point in the history
Remove the fs-3 class from the achievement item names on the
achievements page when listing the achievement items.

When printing the achievement item name with the number of remaining
items, don't treat separately from any > 0 value.

Update the problem selection drop down forms to be clearer on
what the problem number is for and clarifying when double means
double the weight vs increase grade by 50%.
  • Loading branch information
somiaj committed Feb 2, 2025
1 parent 4ca6bb5 commit 4f90e1b
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
7 changes: 3 additions & 4 deletions lib/WeBWorK/AchievementItems.pm
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,12 @@ sub UserItems ($c, $userName, $set, $records) {
}

# Method that returns a string with the achievement name and number of remaining items.
# This should only be called if count != 0.
sub remaining_title ($self, $c) {
if ($self->count > 1) {
if ($self->count > 0) {
return $c->maketext('[_1] ([_2] remaining)', $c->maketext($self->name), $self->count);
} elsif ($self->count < 0) {
return $c->maketext('[_1] (unlimited reusability)', $c->maketext($self->name));
} else {
return $c->maketext('[_1] (1 remains)', $c->maketext($self->name));
return $c->maketext('[_1] (unlimited reusability)', $c->maketext($self->name));
}
}

Expand Down
8 changes: 4 additions & 4 deletions lib/WeBWorK/AchievementItems/DoubleProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ sub print_form ($self, $set, $records, $c) {
return WeBWorK::AchievementItems::form_popup_menu_row(
$c,
id => 'dbp_problem_id',
label_text => $c->maketext('Problem Number'),
first_item => $c->maketext('Choose problem to double.'),
label_text => $c->maketext('Problem number to double weight'),
first_item => $c->maketext('Choose problem to double its weight.'),
values => [
map { [ $c->maketext('Problem [_1] ([_2] to [_3])', $_->problem_id, $_->value, 2 * $_->value) =>
$_->problem_id ] } @$records
Expand All @@ -49,7 +49,7 @@ sub print_form ($self, $set, $records, $c) {
sub use_item ($self, $set, $records, $c) {
my $problemID = $c->param('dbp_problem_id');
unless ($problemID) {
$c->addbadmessage($c->maketext('Select problem to double with the [_1].', $self->name));
$c->addbadmessage($c->maketext('Select problem to double its weight with the [_1].', $self->name));
return '';
}

Expand All @@ -70,7 +70,7 @@ sub use_item ($self, $set, $records, $c) {
$userProblem->value($problem->value);
$db->putUserProblem($userProblem);

return $c->maketext('Problem [_1] increased from [_2] points to [_3] points.',
return $c->maketext('Problem [_1] weight increased from [_2] to [_3].',
$problemID, $orig_value, $problem->value);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/WeBWorK/AchievementItems/DuplicateProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ sub print_form ($self, $set, $records, $c) {
WeBWorK::AchievementItems::form_popup_menu_row(
$c,
id => 'clone_source_problem_id',
label_text => $c->maketext('Problem Number'),
label_text => $c->maketext('Problem number to copy'),
first_item => $c->maketext('Choose problem to copy from.'),
values => [ map { [ $c->maketext('Problem [_1]', $_->problem_id) => $_->problem_id ] } @$records ],
),
WeBWorK::AchievementItems::form_popup_menu_row(
$c,
id => 'clone_dest_problem_id',
label_text => $c->maketext('Problem Number'),
label_text => $c->maketext('Problem number to replace'),
first_item => $c->maketext('Choose problem to replace.'),
values => [ map { [ $c->maketext('Problem [_1]', $_->problem_id) => $_->problem_id ] } @$records ],
),
Expand Down
6 changes: 3 additions & 3 deletions lib/WeBWorK/AchievementItems/FullCreditProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ sub print_form ($self, $set, $records, $c) {
return WeBWorK::AchievementItems::form_popup_menu_row(
$c,
id => 'full_cred_problem_id',
label_text => $c->maketext('Problem Number'),
label_text => $c->maketext('Problem number to give full credit'),
first_item => $c->maketext('Choose problem to give full credit.'),
values => [
map { [ $c->maketext('Problem [_1] ([_2]% to 100%)', $_->problem_id, 100 * wwRound(2, $_->status)) =>
Expand All @@ -57,7 +57,7 @@ sub print_form ($self, $set, $records, $c) {
sub use_item ($self, $set, $records, $c) {
my $problemID = $c->param('full_cred_problem_id');
unless ($problemID) {
$c->addbadmessage($c->maketext('Select problem to give 100% to the [_1].', $self->name));
$c->addbadmessage($c->maketext('Select problem to give full credit with the [_1].', $self->name));
return '';
}

Expand All @@ -79,7 +79,7 @@ sub use_item ($self, $set, $records, $c) {
$userProblem->sub_status(1);
$db->putUserProblem($userProblem);

return $c->maketext('Problem number [_1] increased to 100%.', $problemID);
return $c->maketext('Problem number [_1] given full credit.', $problemID);
}

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

Expand All @@ -42,8 +42,8 @@ sub print_form ($self, $set, $records, $c) {
return WeBWorK::AchievementItems::form_popup_menu_row(
$c,
id => 'half_cred_problem_id',
label_text => $c->maketext('Problem Number'),
first_item => $c->maketext('Choose problem to increase 50%.'),
label_text => $c->maketext('Problem number to give half credit'),
first_item => $c->maketext('Choose problem to increase grade by 50%.'),
values => [
map { [
$c->maketext(
Expand All @@ -60,7 +60,7 @@ sub print_form ($self, $set, $records, $c) {
sub use_item ($self, $set, $records, $c) {
my $problemID = $c->param('half_cred_problem_id');
unless ($problemID) {
$c->addbadmessage($c->maketext('Select problem to add 50% with the [_1].', $self->name));
$c->addbadmessage($c->maketext('Select problem to increase its grade by 50% with the [_1].', $self->name));
return '';
}

Expand All @@ -82,7 +82,8 @@ sub use_item ($self, $set, $records, $c) {
$userProblem->sub_status($problem->status);
$db->putUserProblem($userProblem);

return $c->maketext('Problem number [_1] increased to [_2]%.', $problemID, 100 * wwRound(2, $problem->status));
return $c->maketext('Problem number [_1] grade increased to [_2]%.', $problemID,
100 * wwRound(2, $problem->status));
}

1;
2 changes: 1 addition & 1 deletion lib/WeBWorK/AchievementItems/ResetIncorrectAttempts.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sub print_form ($self, $set, $records, $c) {
return WeBWorK::AchievementItems::form_popup_menu_row(
$c,
id => 'reset_attempts_problem_id',
label_text => $c->maketext('Problem Number'),
label_text => $c->maketext('Problem number to reset incorrect attempts'),
first_item => $c->maketext('Choose problem to reset incorrect attempts.'),
values => [
map { [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</p>
<dl class="mx-4">
% for my $item (@{ $c->{achievementItems} }) {
<dt class="fs-3">
<dt>
<%= $item->remaining_title($c) %>
</dt>
<dd class="ms-3 mb-2"><%= maketext($item->description) %></dd>
Expand Down

0 comments on commit 4f90e1b

Please sign in to comment.