X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FData%2FResult%2FOpen.pm;h=e5c45e251b78ac4a66e09954112aa2bff5261518;hb=78c794d653161038dd4ef5986d7c7a5b96baff82;hp=52b7578b4f469601b90f3958f76ada48b97245f6;hpb=b2725d9d3f2603f7adfa0743862d666e21b1cd32;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/Data/Result/Open.pm b/lib/Gruntmaster/Data/Result/Open.pm index 52b7578..e5c45e2 100644 --- a/lib/Gruntmaster/Data/Result/Open.pm +++ b/lib/Gruntmaster/Data/Result/Open.pm @@ -8,6 +8,10 @@ package Gruntmaster::Data::Result::Open; Gruntmaster::Data::Result::Open +=head1 DESCRIPTION + +List of (contest, problem, user, time when user opened problem) + =cut use strict; @@ -89,7 +93,7 @@ __PACKAGE__->belongs_to( "contest", "Gruntmaster::Data::Result::Contest", { id => "contest" }, - { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, ); =head2 owner @@ -104,7 +108,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 @@ -119,13 +123,39 @@ __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" }, ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-24 09:25:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MgoDt8QyQeSpjIJZEd5RXQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-12-19 16:44:22 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jAao0vjOW87mO37ZQhm4Cw + +use Class::Method::Modifiers qw/after/; + +sub rawcontest { shift->get_column('contest') } +sub rawowner { shift->get_column('owner') } +sub rawproblem { shift->get_column('problem') } +after qw/insert update delete/ => sub { + my ($self) = @_; + Gruntmaster::Data::purge '/st/' . $self->rawcontest; +}; -# You can replace this text with custom code or comments, and it will be preserved on regeneration 1; + +__END__ + +=head1 AUTHOR + +Marius Gavrilescu Emarius@ieval.roE + +=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