From 723bcdd81ed30d7665783cf5fbcfe3128ca2977d Mon Sep 17 00:00:00 2001 From: Menci Date: Mon, 12 Jun 2017 09:41:59 +0800 Subject: [PATCH] Fix status in contest page not updated when submit in NOI contests --- models/contest.js | 2 -- models/contest_player.js | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/models/contest.js b/models/contest.js index 44be281..edf3cb1 100644 --- a/models/contest.js +++ b/models/contest.js @@ -115,8 +115,6 @@ class Contest extends Model { } async newSubmission(judge_state) { - if (judge_state.pending) return; - let problems = await this.getProblems(); if (!problems.includes(judge_state.problem_id)) throw new ErrorMessage('当前比赛中无此题目。'); diff --git a/models/contest_player.js b/models/contest_player.js index 5744329..300618b 100644 --- a/models/contest_player.js +++ b/models/contest_player.js @@ -71,6 +71,8 @@ class ContestPlayer extends Model { async updateScore(judge_state) { await this.loadRelationships(); if (this.contest.type === 'ioi') { + if (judge_state.pending) return; + if (!this.score_details[judge_state.problem_id]) { this.score_details[judge_state.problem_id] = { score: judge_state.score, @@ -113,6 +115,8 @@ class ContestPlayer extends Model { this.score += this.score_details[x].score; } } else if (this.contest.type === 'acm') { + if (judge_state.pending) return; + if (!this.score_details[judge_state.problem_id]) { this.score_details[judge_state.problem_id] = { accepted: false,