my $columns = PROBLEM_PUBLIC_COLUMNS;
push @$columns, 'solution' unless $running;
my $pb = $self->problems->find($id, {columns => $columns, prefetch => 'owner'});
- eval { ## no critic (RequireCheckingReturnValueOfEval)
- $self->opens->create({
- contest => $contest,
- problem => $id,
- owner => $user,
- time => time,
- })
- } if $running;
+ my $open;
+ $open = $self->opens->find_or_create({
+ contest => $contest,
+ problem => $id,
+ owner => $user,
+ time => time,
+ }) if $running;
$contest &&= $self->contest($contest);
- +{ $pb->get_columns, owner_name => $pb->owner->name, cansubmit => $contest ? $running : 1, $running ? (contest_start => $contest->start, contest_stop => $contest->stop) : () }
+ +{
+ $pb->get_columns,
+ owner_name => $pb->owner->name,
+ cansubmit => $running || !$contest,
+ $running ? (
+ contest_start => $contest->start,
+ contest_stop => $contest->stop,
+ open_time => $open->time
+ ) : (),
+ }
}
sub contest_list {