]> iEval git - gruntmaster-data.git/blobdiff - lib/Gruntmaster/Data.pm
Make standings DTRT when a contest has no jobs
[gruntmaster-data.git] / lib / Gruntmaster / Data.pm
index 16a6176fcf65e6b0cf8c5c5d41590d5e6bdb6c7e..ed40c3744ca5582ee3fb6001a31512548bf7c3ff 100644 (file)
@@ -174,10 +174,17 @@ sub job_entry {
 
 sub update_status {
        my ($self) = @_;
-       my @jobs = $self->jobs->search(undef, {cache => 1})->all;
+       my @jobs = $self->jobs->search({'me.private' => 0}, {cache => 1, prefetch => 'problem'})->all;
 
+       my %private;
        my %hash;
-       $hash{$_->get_column('problem'), $_->get_column('owner')} = [$_->id, $_->result ? 0 : 1] for @jobs;
+       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;
 
        my @contest_statuses = map {
This page took 0.02413 seconds and 4 git commands to generate.