|
|
|
@ -131,7 +131,7 @@ app.get('/contest/:id', async (req, res) => {
|
|
|
|
|
|
|
|
|
|
let contest = await Contest.fromID(contest_id); |
|
|
|
|
if (!contest) throw new ErrorMessage('无此比赛。'); |
|
|
|
|
if (!contest.is_public && (!res.locals.user || !res.locals.user.is_admin)) throw new ErrorMessage('无此比赛。'); |
|
|
|
|
if (!contest.is_public && (!res.locals.user || !res.locals.user.is_admin)) throw new ErrorMessage('比赛未公开,请耐心等待 (´∀ `)'); |
|
|
|
|
|
|
|
|
|
const isSupervisior = await contest.isSupervisior(curUser); |
|
|
|
|
contest.running = contest.isRunning(); |
|
|
|
@ -232,6 +232,7 @@ app.get('/contest/:id/ranklist', async (req, res) => {
|
|
|
|
|
const curUser = res.locals.user; |
|
|
|
|
|
|
|
|
|
if (!contest) throw new ErrorMessage('无此比赛。'); |
|
|
|
|
if (!contest.is_public && (!res.locals.user || !res.locals.user.is_admin)) throw new ErrorMessage('比赛未公开,请耐心等待 (´∀ `)'); |
|
|
|
|
if ([contest.allowedSeeingResult() && contest.allowedSeeingOthers(), |
|
|
|
|
contest.isEnded(), |
|
|
|
|
await contest.isSupervisior(curUser)].every(x => !x)) |
|
|
|
@ -290,7 +291,7 @@ app.get('/contest/:id/submissions', async (req, res) => {
|
|
|
|
|
try { |
|
|
|
|
let contest_id = parseInt(req.params.id); |
|
|
|
|
let contest = await Contest.fromID(contest_id); |
|
|
|
|
if (!contest) throw new ErrorMessage('无此比赛。'); |
|
|
|
|
if (!contest.is_public && (!res.locals.user || !res.locals.user.is_admin)) throw new ErrorMessage('比赛未公开,请耐心等待 (´∀ `)'); |
|
|
|
|
|
|
|
|
|
if (contest.isEnded()) { |
|
|
|
|
res.redirect(syzoj.utils.makeUrl(['submissions'], { contest: contest_id })); |
|
|
|
|