sub (/robots.txt) { NOT_FOUND },
sub (/src/:job) {
- my $job = job_full $_{job};
+ my $job = db->select(jobs => '*', {id => $_{job}})->hash;
return NOT_FOUND if !$job;
my $isowner = remote_user && remote_user->{id} eq $job->{owner};
my $contest = $job->{contest} && contest_entry $job->{contest};
},
},
- sub (/st/:contest) { response st => 'Standings', standings($_{contest}), 10 },
+ sub (/st/:contest) {
+ my @pb = map { [$_->{id}, $_->{name}] } @{problem_list contest => $_{contest}};
+ response st => 'Standings', {problems => \@pb, st => standings $_{contest}}, 10
+ },
sub (/ed/:contest) {
- my $contest = contest_full $_{contest};
- forbid !$contest->{finished};
+ my $contest = db->select(contests => '*', {id => $_{contest}})->hash;
+ forbid time < $contest->{stop};
my $pblist = problem_list contest => $_{contest}, solution => 1;
- response ed => 'Editorial of ' . $contest->{name}, {%$pblist, editorial => $contest->{editorial}}
+ response ed => 'Editorial of ' . $contest->{name}, {pb => $pblist, editorial => $contest->{editorial}}
},
sub (/login) {
sub (/ct/:contest/log/st) { redirect "/st/$_{contest}" },
sub (/us/) { response us => 'Users', {us => user_list} },
- sub (/ct/ + ?:owner~) { response ct => 'Contests', contest_list(%_), 300 },
+ sub (/ct/ + ?:owner~) { response ct => 'Contests', {ct => contest_list(%_)}, 300 },
sub (/log/ + ?:contest~&:owner~&:page~&:problem~&:private~&:result~) {
forbid $_{private};
- response log => 'Job list', job_list(%_), 5
+ my ($jobs, $pageinfo) = job_list(%_);
+ response log => 'Job list', {log => $jobs, %$pageinfo}, 5
},
sub (/pb/ + ?:owner~&:contest~&:private~) {
forbid $_{private};
my $pending = $_{contest} && !contest_entry($_{contest})->{started};
forbid $pending;
- response pb => 'Problems', problem_list %_
+ response pb => 'Problems', {pb => problem_list %_}
},
sub (/us/:user) {