]> iEval git - gruntmaster-data.git/blobdiff - lib/Gruntmaster/Data/Result/Problem.pm
Add some utility functions and POD
[gruntmaster-data.git] / lib / Gruntmaster / Data / Result / Problem.pm
index 6b12ac552951d3fd18723f2428eb96f449e15a8e..05b6de94f14f935a306cc682ed0ad6afb6ab2ec3 100644 (file)
@@ -31,7 +31,12 @@ __PACKAGE__->table("problems");
 =head2 author
 
   data_type: 'text'
-  is_nullable: 0
+  is_nullable: 1
+
+=head2 writer
+
+  data_type: 'text'
+  is_nullable: 1
 
 =head2 generator
 
@@ -104,6 +109,16 @@ __PACKAGE__->table("problems");
   data_type: 'integer'
   is_nullable: 1
 
+=head2 genformat
+
+  data_type: 'text'
+  is_nullable: 1
+
+=head2 gensource
+
+  data_type: 'text'
+  is_nullable: 1
+
 =head2 verformat
 
   data_type: 'text'
@@ -120,7 +135,9 @@ __PACKAGE__->add_columns(
   "id",
   { data_type => "text", is_nullable => 0 },
   "author",
-  { data_type => "text", is_nullable => 0 },
+  { data_type => "text", is_nullable => 1 },
+  "writer",
+  { data_type => "text", is_nullable => 1 },
   "generator",
   {
     data_type => "enum",
@@ -169,6 +186,10 @@ __PACKAGE__->add_columns(
   { data_type => "real", is_nullable => 0 },
   "value",
   { data_type => "integer", is_nullable => 1 },
+  "genformat",
+  { data_type => "text", is_nullable => 1 },
+  "gensource",
+  { data_type => "text", is_nullable => 1 },
   "verformat",
   { data_type => "text", is_nullable => 1 },
   "versource",
@@ -260,9 +281,53 @@ Composing rels: L</contest_problems> -> contest
 __PACKAGE__->many_to_many("contests", "contest_problems", "contest");
 
 
-# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-24 09:25:07
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dZicbasR8lUFGhIabrWxXw
+# 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<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.
+
+=head1 AUTHOR
+
+Marius Gavrilescu E<lt>marius@ieval.roE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2014 by Marius Gavrilescu
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.18.1 or,
+at your option, any later version of Perl 5 you may have available.
+
+
+=cut
This page took 0.025252 seconds and 4 git commands to generate.