Browse Source

Fix user ac_num not updated

master
Menci 8 years ago
parent
commit
fee687dc3b
  1. 12
      models/judge_state.js

12
models/judge_state.js

@ -186,6 +186,12 @@ class JudgeState extends Model {
} else if (this.type === 1) { } else if (this.type === 1) {
let contest = await Contest.fromID(this.type_info); let contest = await Contest.fromID(this.type_info);
await contest.newSubmission(this); await contest.newSubmission(this);
} else if (this.type === 2) {
if (newSubmission || this.status === 'Accepted') {
await this.loadRelationships();
await this.user.refreshSubmitInfo();
await this.user.save();
}
} }
} }
@ -209,14 +215,16 @@ class JudgeState extends Model {
await waiting_judge.save(); await waiting_judge.save();
if (this.type === 0) {
if (oldStatus === 'Accepted') { if (oldStatus === 'Accepted') {
this.problem.ac_num--;
await this.user.refreshSubmitInfo(); await this.user.refreshSubmitInfo();
await this.user.save(); await this.user.save();
} }
if (this.type === 0) {
if (oldStatus === 'Accepted') {
this.problem.ac_num--;
await this.problem.save(); await this.problem.save();
}
} else if (this.type === 1) { } else if (this.type === 1) {
let contest = await Contest.fromID(this.type_info); let contest = await Contest.fromID(this.type_info);
await contest.newSubmission(this); await contest.newSubmission(this);

Loading…
Cancel
Save