]> iEval git - gruntmaster-data.git/blobdiff - lib/Gruntmaster/Data/Result/Problem.pm
Make problem value NOT NULL
[gruntmaster-data.git] / lib / Gruntmaster / Data / Result / Problem.pm
index 18e1852be4d06d26efda48594bd34a4a29a12a97..0f4667e3ccc6cc2e1c26636388b116330eb1ed5b 100644 (file)
@@ -33,22 +33,24 @@ __PACKAGE__->table("problems");
   data_type: 'text'
   is_nullable: 1
 
+=head2 writer
+
+  data_type: 'text'
+  is_nullable: 1
+
 =head2 generator
 
-  data_type: 'enum'
-  extra: {custom_type_name => "generator",list => ["File","Run","Undef"]}
+  data_type: 'text'
   is_nullable: 0
 
 =head2 judge
 
-  data_type: 'enum'
-  extra: {custom_type_name => "judge",list => ["Absolute","Points"]}
+  data_type: 'text'
   is_nullable: 0
 
 =head2 level
 
-  data_type: 'enum'
-  extra: {custom_type_name => "plevel",list => ["beginner","easy","medium","hard"]}
+  data_type: 'text'
   is_nullable: 0
 
 =head2 name
@@ -75,8 +77,7 @@ __PACKAGE__->table("problems");
 
 =head2 runner
 
-  data_type: 'enum'
-  extra: {custom_type_name => "runner",list => ["File","Verifier","Interactive"]}
+  data_type: 'text'
   is_nullable: 0
 
 =head2 statement
@@ -102,7 +103,7 @@ __PACKAGE__->table("problems");
 =head2 value
 
   data_type: 'integer'
-  is_nullable: 1
+  is_nullable: 0
 
 =head2 genformat
 
@@ -131,27 +132,14 @@ __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",
-    extra => { custom_type_name => "generator", list => ["File", "Run", "Undef"] },
-    is_nullable => 0,
-  },
+  { data_type => "text", is_nullable => 0 },
   "judge",
-  {
-    data_type => "enum",
-    extra => { custom_type_name => "judge", list => ["Absolute", "Points"] },
-    is_nullable => 0,
-  },
+  { data_type => "text", is_nullable => 0 },
   "level",
-  {
-    data_type => "enum",
-    extra => {
-      custom_type_name => "plevel",
-      list => ["beginner", "easy", "medium", "hard"],
-    },
-    is_nullable => 0,
-  },
+  { data_type => "text", is_nullable => 0 },
   "name",
   { data_type => "text", is_nullable => 0 },
   "olimit",
@@ -161,14 +149,7 @@ __PACKAGE__->add_columns(
   "private",
   { data_type => "boolean", default_value => \"false", is_nullable => 0 },
   "runner",
-  {
-    data_type => "enum",
-    extra => {
-      custom_type_name => "runner",
-      list => ["File", "Verifier", "Interactive"],
-    },
-    is_nullable => 0,
-  },
+  { data_type => "text", is_nullable => 0 },
   "statement",
   { data_type => "text", is_nullable => 0 },
   "testcnt",
@@ -178,7 +159,7 @@ __PACKAGE__->add_columns(
   "timeout",
   { data_type => "real", is_nullable => 0 },
   "value",
-  { data_type => "integer", is_nullable => 1 },
+  { data_type => "integer", is_nullable => 0 },
   "genformat",
   { data_type => "text", is_nullable => 1 },
   "gensource",
@@ -260,7 +241,7 @@ __PACKAGE__->belongs_to(
   "owner",
   "Gruntmaster::Data::Result::User",
   { id => "owner" },
-  { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
+  { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
 );
 
 =head2 contests
@@ -274,9 +255,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-26 15:24:46
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QeM8iOMQE3lqG2tXKbpRxw
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-12-01 14:39:28
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/p3BIfVYSG5AKSSgVgOoOQ
+
+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.025975 seconds and 4 git commands to generate.