X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FData%2FResult%2FProblem.pm;h=05b6de94f14f935a306cc682ed0ad6afb6ab2ec3;hb=4a8747effd02a1e0f9dde86b1c81f6c26ce66f04;hp=18e1852be4d06d26efda48594bd34a4a29a12a97;hpb=85d3f015cc4e11f00adba9d3a99cb69c7f77156b;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/Data/Result/Problem.pm b/lib/Gruntmaster/Data/Result/Problem.pm index 18e1852..05b6de9 100644 --- a/lib/Gruntmaster/Data/Result/Problem.pm +++ b/lib/Gruntmaster/Data/Result/Problem.pm @@ -33,6 +33,11 @@ __PACKAGE__->table("problems"); data_type: 'text' is_nullable: 1 +=head2 writer + + data_type: 'text' + is_nullable: 1 + =head2 generator data_type: 'enum' @@ -131,6 +136,8 @@ __PACKAGE__->add_columns( { data_type => "text", is_nullable => 0 }, "author", { data_type => "text", is_nullable => 1 }, + "writer", + { data_type => "text", is_nullable => 1 }, "generator", { data_type => "enum", @@ -274,9 +281,53 @@ Composing rels: L -> contest __PACKAGE__->many_to_many("contests", "contest_problems", "contest"); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-26 15:24:46 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QeM8iOMQE3lqG2tXKbpRxw +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-30 12:59:34 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ujwyMJ5Pup1i5NKXkPkg2g + +sub is_private { + my ($self, $time) = @_; + 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 +} -# You can replace this text with custom code or comments, and it will be preserved on regeneration 1; + +__END__ + +=head1 METHODS + +=head2 is_private(I<[$time]>) + +Returns true if the problem is private at time I<$time> (which defaults to C