Browse Source

Let null scores be omitted.

pull/6/head
t123yh 7 years ago
parent
commit
67fd4b3df3
  1. 6
      models/contest_player.js

6
models/contest_player.js

@ -44,7 +44,7 @@ let model = db.define('contest_player', {
fields: ['user_id'], fields: ['user_id'],
} }
] ]
}); });
let Model = require('./common'); let Model = require('./common');
class ContestPlayer extends Model { class ContestPlayer extends Model {
@ -102,6 +102,7 @@ class ContestPlayer extends Model {
this.score = 0; this.score = 0;
for (let x in this.score_details) { for (let x in this.score_details) {
if (this.score != null)
this.score += this.score_details[x].score; this.score += this.score_details[x].score;
} }
} }
@ -115,6 +116,7 @@ class ContestPlayer extends Model {
this.score = 0; this.score = 0;
for (let x in this.score_details) { for (let x in this.score_details) {
if (this.score != null)
this.score += this.score_details[x].score; this.score += this.score_details[x].score;
} }
} else if (this.contest.type === 'acm') { } else if (this.contest.type === 'acm') {
@ -132,7 +134,7 @@ class ContestPlayer extends Model {
this.score_details[judge_state.problem_id].submissions[judge_state.id] = { this.score_details[judge_state.problem_id].submissions[judge_state.id] = {
judge_id: judge_state.id, judge_id: judge_state.id,
accepted: judge_state.status === 'Accepted', accepted: judge_state.status === 'Accepted',
compiled: judge_state.status !== 'Compile Error', compiled: judge_state.score != null,
time: judge_state.submit_time time: judge_state.submit_time
}; };

Loading…
Cancel
Save