reply 'Password changed successfully';
},
- sub (/action/submit + %:problem=&:contest~&:prog_format=&:source_code~ + *:prog~) {
+ sub (/action/submit + %:problem=&:contest~&:prog_format=&:source_code~ + *prog~) {
+ my (undef, undef, $prog) = @_;
forbid !remote_user;
return reply 'This contest has finished' if contest && contest->is_finished;
return reply 'This contest has not yet started' if !admin && contest && contest->is_pending;
- return reply 'Maximum source size is 10KB' if ($_{prog} ? $_{prog}->size : length $_{source_code}) > 10 * 1024;
+ return reply 'Maximum source size is 10KB' if ($prog ? $prog->size : length $_{source_code}) > 10 * 1024;
return reply 'You must wait 30 seconds between jobs' if !admin && time <= remote_user->lastjob + 30;
remote_user->update({lastjob => time});
- my $prog = $_{prog} ? read_file $_{prog}->path : $_{source_code};
- unlink $_{prog}->path if $_{prog};
+ my $source = $prog ? read_file $prog->path : $_{source_code};
+ unlink $prog->path if $prog;
db->jobs->create({
maybe contest => $_{contest},
maybe private => problem->private,
extension => FORMAT_EXTENSION->{$_{prog_format}},
format => $_{prog_format},
problem => $_{problem},
- source => $prog,
+ source => $source,
owner => remote_user->id,
});