use PerlX::Maybe qw/maybe/;
use Sub::Name qw/subname/;
+use constant CONTEST_PUBLIC_COLUMNS => [qw/id name description start stop owner/];
use constant PROBLEM_PUBLIC_COLUMNS => [qw/id author writer level name owner private timeout olimit value/];
use constant USER_PUBLIC_COLUMNS => [qw/id admin name town university country level/];
use constant JOBS_PER_PAGE => 10;
sub contest_list {
my ($self, %args) = @_;
- my $rs = $self->contests->search(undef, {order_by => {-desc => 'start'}, prefetch => 'owner'});
+ my $rs = $self->contests->search(undef, {columns => CONTEST_PUBLIC_COLUMNS, order_by => {-desc => 'start'}, prefetch => 'owner'});
$rs = $rs->search({owner => $args{owner}}) if $args{owner};
my %params;
for ($rs->all) {
sub contest_entry {
my ($self, $id) = @_;
- my $ct = $self->contest($id);
+ my $ct = $self->contests->find($id,{columns => CONTEST_PUBLIC_COLUMNS});
+{ $ct->get_columns, started => !$ct->is_pending, finished => $ct->is_finished, owner_name => $ct->owner->name }
}