X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;ds=sidebyside;f=lib%2FGruntmaster%2FData%2FResult%2FContest.pm;h=fcb6a966185f16d9770792c67415c26b6b243b38;hb=4a8747effd02a1e0f9dde86b1c81f6c26ce66f04;hp=829cde652d0900345c88dc0519f4da96bc68e7dd;hpb=64e8a4c75bb8b4ab64865296a11c15e25d1cecc2;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/Data/Result/Contest.pm b/lib/Gruntmaster/Data/Result/Contest.pm index 829cde6..fcb6a96 100644 --- a/lib/Gruntmaster/Data/Result/Contest.pm +++ b/lib/Gruntmaster/Data/Result/Contest.pm @@ -152,6 +152,50 @@ __PACKAGE__->many_to_many("problems", "contest_problems", "problem"); # Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-06 12:41:16 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T5tUpU1TOahLKzx9iVie3A +sub is_pending { + my ($self, $time) = @_; + $self->start > ($time // time) +} + +sub is_finished { + my ($self, $time) = @_; + $self->stop <= ($time // time) +} + +sub is_running { + my ($self, $time) = @_; + !$self->is_pending($time) && !$self->is_finished($time) +} -# You can replace this text with custom code or comments, and it will be preserved on regeneration 1; + +__END__ + +=head1 METHODS + +=head2 is_pending(I<[$time]>) + +Returns true if the contest is pending at time I<$time> (which defaults to C