X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FData%2FResult%2FJob.pm;h=39d44bd81716ab02d910dceecfed6f6f9941ec84;hb=78c794d653161038dd4ef5986d7c7a5b96baff82;hp=09c85dfdd5d27383959a3a7ed2e8034253f332d1;hpb=4a8747effd02a1e0f9dde86b1c81f6c26ce66f04;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/Data/Result/Job.pm b/lib/Gruntmaster/Data/Result/Job.pm index 09c85df..39d44bd 100644 --- a/lib/Gruntmaster/Data/Result/Job.pm +++ b/lib/Gruntmaster/Data/Result/Job.pm @@ -6,7 +6,7 @@ package Gruntmaster::Data::Result::Job; =head1 NAME -Gruntmaster::Data::Result::Job +Gruntmaster::Data::Result::Job - List of jobs =cut @@ -41,26 +41,36 @@ __PACKAGE__->table("jobs"); data_type: 'text' is_nullable: 1 +hostname:PID of daemon that last executed this job. NULL if never executed + =head2 date data_type: 'bigint' is_nullable: 0 +Unix time when job was submitted + =head2 errors data_type: 'text' is_nullable: 1 +Compiler errors + =head2 extension data_type: 'text' is_nullable: 0 +File extension of submitted program, without a leading dot + =head2 format data_type: 'text' is_nullable: 0 +Format (programming language) of submitted program + =head2 private data_type: 'boolean' @@ -78,16 +88,22 @@ __PACKAGE__->table("jobs"); data_type: 'integer' is_nullable: 1 +Job result (integer constant from Gruntmaster::Daemon::Constants) + =head2 result_text data_type: 'text' is_nullable: 1 +Job result (human-readable text) + =head2 results data_type: 'text' is_nullable: 1 +Per-test results (JSON array of hashes with keys id (test number, counting from 1), result (integer constant from Gruntmaster::Daemon::Constants), result_text (human-readable text), time (execution time in decimal seconds)) + =head2 source data_type: 'text' @@ -166,7 +182,7 @@ __PACKAGE__->belongs_to( { is_deferrable => 0, join_type => "LEFT", - on_delete => "NO ACTION", + on_delete => "CASCADE", on_update => "NO ACTION", }, ); @@ -183,7 +199,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 problem @@ -198,17 +214,47 @@ __PACKAGE__->belongs_to( "problem", "Gruntmaster::Data::Result::Problem", { id => "problem" }, - { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, +); + +=head2 problem_statuses + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "problem_statuses", + "Gruntmaster::Data::Result::ProblemStatus", + { "foreign.job" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-26 15:24:46 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dnYOXMU6Or/Wh0m5A1N5UA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-12-19 16:54:00 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hEAVL5heV13+nalSmgr0WA + +use Class::Method::Modifiers qw/after/; + +sub rawcontest { shift->get_column('contest') } +sub rawowner { shift->get_column('owner') } +sub rawproblem { shift->get_column('problem') } sub rerun { shift->update({daemon => undef, result => -2, result_text => undef}); } +after qw/insert update delete/ => sub { + my ($self) = @_; + Gruntmaster::Data::purge '/us/'; + Gruntmaster::Data::purge '/us/' . $self->rawowner; + Gruntmaster::Data::purge '/st/' . $self->rawcontest if $self->rawcontest; + Gruntmaster::Data::purge '/log/'; + Gruntmaster::Data::purge '/log/' . $self->id; +}; + 1; __END__