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;
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;