Skip to content

Commit

Permalink
Merge pull request openwebwork#2469 from Alex-Jordan/more-achievement…
Browse files Browse the repository at this point in the history
…-tweaks

let certain achievements apply to closed sets
  • Loading branch information
drgrice1 authored Aug 6, 2024
2 parents 16a173d + 0f5b896 commit c9a78b7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/WeBWorK/AchievementItems/DoubleProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use Mojo::Base 'WeBWorK::AchievementItems', -signatures;
use Mojo::JSON qw(encode_json);

use WeBWorK::Utils qw(x nfreeze_base64 thaw_base64);
use WeBWorK::Utils::DateTime qw(between);
use WeBWorK::Utils::DateTime qw(after);
use WeBWorK::Utils::Sets qw(format_set_name_display);

sub new ($class) {
Expand All @@ -39,7 +39,7 @@ sub print_form ($self, $sets, $setProblemIds, $c) {
my (@openSets, @initialProblemIDs);

for my $i (0 .. $#$sets) {
if (between($sets->[$i]->open_date, $sets->[$i]->due_date)
if (after($sets->[$i]->open_date)
&& $sets->[$i]->assignment_type eq 'default'
&& @{ $setProblemIds->{ $sets->[$i]->set_id } })
{
Expand Down
4 changes: 2 additions & 2 deletions lib/WeBWorK/AchievementItems/DoubleSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use Mojo::Base 'WeBWorK::AchievementItems', -signatures;
# Item to make a homework set worth twice as much

use WeBWorK::Utils qw(x nfreeze_base64 thaw_base64);
use WeBWorK::Utils::DateTime qw(between);
use WeBWorK::Utils::DateTime qw(after);
use WeBWorK::Utils::Sets qw(format_set_name_display);

sub new ($class) {
Expand All @@ -35,7 +35,7 @@ sub print_form ($self, $sets, $setProblemIds, $c) {

for my $i (0 .. $#$sets) {
push(@openSets, [ format_set_name_display($sets->[$i]->set_id) => $sets->[$i]->set_id ])
if (between($sets->[$i]->open_date, $sets->[$i]->due_date) && $sets->[$i]->assignment_type eq 'default');
if (after($sets->[$i]->open_date) && $sets->[$i]->assignment_type eq 'default');
}

return unless @openSets;
Expand Down
4 changes: 2 additions & 2 deletions lib/WeBWorK/AchievementItems/FullCreditProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use Mojo::Base 'WeBWorK::AchievementItems', -signatures;
use Mojo::JSON qw(encode_json);

use WeBWorK::Utils qw(x nfreeze_base64 thaw_base64);
use WeBWorK::Utils::DateTime qw(between);
use WeBWorK::Utils::DateTime qw(after);
use WeBWorK::Utils::Sets qw(format_set_name_display);

sub new ($class) {
Expand All @@ -39,7 +39,7 @@ sub print_form ($self, $sets, $setProblemIds, $c) {
my (@openSets, @initialProblemIDs);

for my $i (0 .. $#$sets) {
if (between($sets->[$i]->open_date, $sets->[$i]->due_date)
if (after($sets->[$i]->open_date)
&& $sets->[$i]->assignment_type eq 'default'
&& @{ $setProblemIds->{ $sets->[$i]->set_id } })
{
Expand Down
4 changes: 2 additions & 2 deletions lib/WeBWorK/AchievementItems/FullCreditSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use Mojo::Base 'WeBWorK::AchievementItems', -signatures;
# Item to give half credit on all problems in a homework set.

use WeBWorK::Utils qw(x nfreeze_base64 thaw_base64);
use WeBWorK::Utils::DateTime qw(between);
use WeBWorK::Utils::DateTime qw(after);
use WeBWorK::Utils::Sets qw(format_set_name_display);

sub new ($class) {
Expand All @@ -35,7 +35,7 @@ sub print_form ($self, $sets, $setProblemIds, $c) {

for my $i (0 .. $#$sets) {
push(@openSets, [ format_set_name_display($sets->[$i]->set_id) => $sets->[$i]->set_id ])
if (between($sets->[$i]->open_date, $sets->[$i]->due_date) && $sets->[$i]->assignment_type eq 'default');
if (after($sets->[$i]->open_date) && $sets->[$i]->assignment_type eq 'default');
}

return unless @openSets;
Expand Down
4 changes: 2 additions & 2 deletions lib/WeBWorK/AchievementItems/HalfCreditProb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use Mojo::Base 'WeBWorK::AchievementItems', -signatures;
use Mojo::JSON qw(encode_json);

use WeBWorK::Utils qw(x nfreeze_base64 thaw_base64);
use WeBWorK::Utils::DateTime qw(between);
use WeBWorK::Utils::DateTime qw(after);
use WeBWorK::Utils::Sets qw(format_set_name_display);

sub new ($class) {
Expand All @@ -39,7 +39,7 @@ sub print_form ($self, $sets, $setProblemIds, $c) {
my (@openSets, @initialProblemIDs);

for my $i (0 .. $#$sets) {
if (between($sets->[$i]->open_date, $sets->[$i]->due_date)
if (after($sets->[$i]->open_date)
&& $sets->[$i]->assignment_type eq 'default'
&& @{ $setProblemIds->{ $sets->[$i]->set_id } })
{
Expand Down
4 changes: 2 additions & 2 deletions lib/WeBWorK/AchievementItems/HalfCreditSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use Mojo::Base 'WeBWorK::AchievementItems', -signatures;
# Item to give half credit on all problems in a homework set.

use WeBWorK::Utils qw(x nfreeze_base64 thaw_base64);
use WeBWorK::Utils::DateTime qw(between);
use WeBWorK::Utils::DateTime qw(after);
use WeBWorK::Utils::Sets qw(format_set_name_display);

sub new ($class) {
Expand All @@ -35,7 +35,7 @@ sub print_form ($self, $sets, $setProblemIds, $c) {

for my $i (0 .. $#$sets) {
push(@openSets, [ format_set_name_display($sets->[$i]->set_id) => $sets->[$i]->set_id ])
if (between($sets->[$i]->open_date, $sets->[$i]->due_date) && $sets->[$i]->assignment_type eq 'default');
if (after($sets->[$i]->open_date) && $sets->[$i]->assignment_type eq 'default');
}

return unless @openSets;
Expand Down

0 comments on commit c9a78b7

Please sign in to comment.