diff --git a/models/judge_state.js b/models/judge_state.js index 546123d..a3e33b4 100644 --- a/models/judge_state.js +++ b/models/judge_state.js @@ -105,7 +105,12 @@ class JudgeState extends Model { if (user && user.id === this.problem.user_id) return true; else if (this.type === 0 || this.type == 2) return this.problem.is_public || (user && (await user.hasPrivilege('manage_problem'))); else if (this.type === 1) { - return user && (user.is_admin || user.id === this.user_id); + let contest = await Contest.fromID(this.type_info); + if (await contest.isRunning()) { + return (user && this.user_id === user.id) || (user && user.is_admin); + } else { + return true; + } } }