X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FData.pm;h=fabdbecb9d0b25262dd42542186c3adfb507bd90;hb=d4c5bf27d83bcf826e66bf897ea6ffc790217da1;hp=984035f3352209e3e4a93ba8504e953288b18c93;hpb=7d499cddfb7429f7570ea66b419d226d682ae1e4;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index 984035f..fabdbec 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -75,7 +75,7 @@ sub user_entry { sub problem_list { my ($self, %args) = @_; my $rs = $self->problems->search(undef, {order_by => 'me.name', columns => PROBLEM_PUBLIC_COLUMNS, prefetch => 'owner'}); - $rs = $rs->search({-or => ['contest_problems.contest' => undef, 'contest.stop' => {'<=', time}], 'me.private' => 0}, {join => {'contest_problems' => 'contest'}, distinct => 1}) unless $args{contest}; + $rs = $rs->search({-or => ['contest_problems.contest' => undef, 'contest.stop' => {'<=', time}], 'me.private' => 0}, {join => {'contest_problems' => 'contest'}, distinct => 1}) unless $args{contest} || $args{private}; $rs = $rs->search({'contest_problems.contest' => $args{contest}}, {join => 'contest_problems'}) if $args{contest}; $rs = $rs->search({'me.owner' => $args{owner}}) if $args{owner}; my %params; @@ -127,10 +127,11 @@ sub contest_entry { sub job_list { my ($self, %args) = @_; $args{page} //= 1; - my $rs = $self->jobs->search({'me.private' => 0}, {order_by => {-desc => 'me.id'}, prefetch => ['problem', 'owner'], rows => JOBS_PER_PAGE, page => $args{page}}); - $rs = $rs->search({'me.owner' => $args{owner}}) if $args{owner}; - $rs = $rs->search({contest => $args{contest}}) if $args{contest}; - $rs = $rs->search({problem => $args{problem}}) if $args{problem}; + my $rs = $self->jobs->search(undef, {order_by => {-desc => 'me.id'}, prefetch => ['problem', 'owner'], rows => JOBS_PER_PAGE, page => $args{page}}); + $rs = $rs->search({'me.private'=> 0}) unless $args{private}; + $rs = $rs->search({'me.owner' => $args{owner}}) if $args{owner}; + $rs = $rs->search({contest => $args{contest}}) if $args{contest}; + $rs = $rs->search({problem => $args{problem}}) if $args{problem}; return { log => [map { my %params = $_->get_columns;