]> iEval git - gruntmaster-data.git/commitdiff
Skip private jobs in update_status faster
authorMarius Gavrilescu <marius@ieval.ro>
Wed, 4 Feb 2015 20:40:26 +0000 (22:40 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Wed, 4 Feb 2015 20:40:26 +0000 (22:40 +0200)
lib/Gruntmaster/Data.pm

index 447a9f4119adaf77b2e07a156ec43af084741f8f..ed40c3744ca5582ee3fb6001a31512548bf7c3ff 100644 (file)
@@ -176,10 +176,13 @@ sub update_status {
        my ($self) = @_;
        my @jobs = $self->jobs->search({'me.private' => 0}, {cache => 1, prefetch => 'problem'})->all;
 
+       my %private;
        my %hash;
        for (@jobs) {
-               next if !$_->problem->is_in_archive;
-               $hash{$_->get_column('problem'), $_->get_column('owner')} = [$_->id, $_->result ? 0 : 1] for @jobs;
+               my $pb = $_->get_column('problem');
+               $private{$pb} //= $_->problem->is_private;
+               next if !$private{$pb};
+               $hash{$pb, $_->get_column('owner')} = [$_->id, $_->result ? 0 : 1] for @jobs;
        }
 
        my @problem_statuses = map { [split ($;), @{$hash{$_}} ] } keys %hash;
This page took 0.022975 seconds and 4 git commands to generate.