X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FData%2FResult%2FProblem.pm;h=5b843919c7250507743fc5d542be7012a138aeb6;hb=9bb399215eed61555c05f025aedf6dc53f4e977d;hp=5359df72997d8ffa633b618aa7e0f13feb0715b4;hpb=4ed3f8e7c64594bb4ea26abb1c4fb51a5a8258d6;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/Data/Result/Problem.pm b/lib/Gruntmaster/Data/Result/Problem.pm index 5359df7..5b84391 100644 --- a/lib/Gruntmaster/Data/Result/Problem.pm +++ b/lib/Gruntmaster/Data/Result/Problem.pm @@ -31,24 +31,26 @@ __PACKAGE__->table("problems"); =head2 author data_type: 'text' - is_nullable: 0 + 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 @@ -70,12 +72,12 @@ __PACKAGE__->table("problems"); =head2 private data_type: 'boolean' + default_value: false is_nullable: 0 =head2 runner - data_type: 'enum' - extra: {custom_type_name => "runner",list => ["File","Verifier","Interactive"]} + data_type: 'text' is_nullable: 0 =head2 statement @@ -88,6 +90,11 @@ __PACKAGE__->table("problems"); data_type: 'integer' is_nullable: 0 +=head2 tests + + data_type: 'text' + is_nullable: 1 + =head2 timeout data_type: 'real' @@ -98,6 +105,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' @@ -114,28 +131,15 @@ __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", - 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", @@ -143,24 +147,23 @@ __PACKAGE__->add_columns( "owner", { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, "private", - { data_type => "boolean", is_nullable => 0 }, + { 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", { data_type => "integer", is_nullable => 0 }, + "tests", + { data_type => "text", is_nullable => 1 }, "timeout", { 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", @@ -238,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 @@ -252,9 +255,53 @@ Composing rels: L -> contest __PACKAGE__->many_to_many("contests", "contest_problems", "contest"); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-06 12:41:16 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:y1LUGcxNJxUMgMXqvAkKYQ +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-05-16 15:03:32 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tvap77v0faSMxFiLu1uggQ +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