Remove no longer useful is_private and is_in_archive methods
authorMarius Gavrilescu <marius@ieval.ro>
Tue, 3 Mar 2015 16:39:11 +0000 (18:39 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Tue, 3 Mar 2015 16:39:11 +0000 (18:39 +0200)
lib/Gruntmaster/Data/Result/Problem.pm
t/Gruntmaster-Data.t

index 2ce4f68524be60a712e1102adaf16f1170e3b625..cec4cc89bc4cf0ac6821a16c1b0a0e3c7514a11e 100644 (file)
@@ -332,18 +332,6 @@ after qw/insert update delete/ => sub {
        Gruntmaster::Data::purge '/sol/' . $self->id;
 };
 
-sub is_private {
-       my ($self, $time) = @_;
-       return 0 if grep { !$_->contest->is_pending($time) } $self->contest_problems;
-       return 1 if $self->private;
-       grep { $_->contest->is_pending($time) } $self->contest_problems;
-}
-
-sub is_in_archive {
-       my ($self, $time) = @_;
-       0 == grep { $_->contest->is_running($time) } $self->contest_problems;
-}
-
 sub rerun {
        $_->rerun for shift->jobs
 }
@@ -354,14 +342,6 @@ __END__
 
 =head1 METHODS
 
-=head2 is_private(I<[$time]>)
-
-Returns true if the problem is private at time I<$time> (which defaults to C<time>).
-
-=head2 is_in_archive(I<[$time]>)
-
-Returns true if the problem is in the archive at time I<$time> (which defaults to C<time>).
-
 =head2 rerun
 
 Reruns all jobs for this problem.
index e9d20ac8cf7938b27d05fdd150a3c276eb0fd9c1..3c97f067567fa9729d634a3474ca13fde2038721 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use v5.14;
 
-use Test::More tests => 13;
+use Test::More tests => 6;
 
 BEGIN { use_ok('Gruntmaster::Data') };
 
@@ -18,21 +18,3 @@ ok !$db->contest('rc')->is_pending(25), '!is_pending';
 ok $db->contest('fc')->is_finished(25), 'is_finished';
 ok !$db->contest('rc')->is_finished(25), '!is_finished';
 ok $db->contest('rc')->is_running(25), 'is_running';
-
-$db->problems->create({id => 'pb', name => 'Problem', generator => 'Undef', runner => 'File', judge => 'Absolute', level => 'beginner', value => 100, owner => 'MGV', statement => '...', testcnt => 1, timeout => 1, private => 0});
-
-ok !$db->problem('pb')->is_private(25), '!is_private';
-$db->problem('pb')->update({private => 1});
-ok $db->problem('pb')->is_private(25), 'is_private (explicit)';
-$db->problem('pb')->update({private => 0});
-
-$db->contest_problems->create({contest => 'pc', problem => 'pb'});
-ok $db->problem('pb')->is_private(25), 'is_private (implicit)';
-ok $db->problem('pb')->is_in_archive(25), 'is_in_archive';
-
-$db->contest_problems->create({contest => 'rc', problem => 'pb'});
-ok $db->problem('pb')->is_private(25), 'is_private (also implicit)';
-ok !$db->problem('pb')->is_in_archive(25), '!is_in_archive';
-
-$db->contest_problems->find('rc', 'pb')->delete;
-ok $db->problem('pb')->is_in_archive(25), 'is_in_archive (again)';
This page took 0.013259 seconds and 4 git commands to generate.