]> iEval git - gruntmaster-data.git/blobdiff - lib/Gruntmaster/Data/Result/Contest.pm
Purge affected pages on insert/update/delete
[gruntmaster-data.git] / lib / Gruntmaster / Data / Result / Contest.pm
index 4b1c1f4f288f8f1a0e9292deb01d58bb61711ed9..a82bc0f2a4fdb85ffc71b9924ea79dec84b536d2 100644 (file)
@@ -6,7 +6,7 @@ package Gruntmaster::Data::Result::Contest;
 
 =head1 NAME
 
-Gruntmaster::Data::Result::Contest
+Gruntmaster::Data::Result::Contest - List of contests
 
 =cut
 
@@ -38,11 +38,15 @@ __PACKAGE__->table("contests");
   data_type: 'integer'
   is_nullable: 0
 
+Unix time when contest starts
+
 =head2 stop
 
   data_type: 'integer'
   is_nullable: 0
 
+Unix time when contest ends
+
 =head2 owner
 
   data_type: 'text'
@@ -164,11 +168,18 @@ Composing rels: L</contest_problems> -> problem
 __PACKAGE__->many_to_many("problems", "contest_problems", "problem");
 
 
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-12-11 23:51:27
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nu+Io9AhYkzYCky5UpCaKQ
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-12-19 16:54:00
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IxxZqQwKisBwDabCNUD55Q
 
+use Class::Method::Modifiers qw/after/;
 use List::Util qw/sum/;
 
+after qw/insert update delete/ => sub {
+       my ($self) = @_;
+       Gruntmaster::Data::purge '/ct/';
+       Gruntmaster::Data::purge '/ct/' . $self->id;
+};
+
 sub is_pending {
        my ($self, $time) = @_;
        $self->start > ($time // time)
@@ -212,7 +223,7 @@ sub standings {
                $scores{$job->rawowner}{$job->rawproblem} = int ($factor * calc_score ($value, $time, $tries{$job->rawowner}{$job->rawproblem}++, $self->stop - $self->start));
        }
 
-       my %user_to_name = map { $_ => $_->name } $self->result_source->schema->users->all;
+       my %user_to_name = map { $_->id => $_->name } $self->result_source->schema->users->all;
 
        my @st = sort { $b->{score} <=> $a->{score} or $a->{user} cmp $b->{user} } map { ## no critic (ProhibitReverseSortBlock)
                my $user = $_;
This page took 0.020239 seconds and 4 git commands to generate.