Browse Source

Merge pull request #96 from SDLYYZ/master

Improve robustness
pull/6/head
Menci 6 years ago committed by GitHub
parent
commit
6b465ad9b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      models/common.js
  2. 2
      models/contest_ranklist.js

2
models/common.js

@ -10,6 +10,8 @@ class Model {
let model = this.getModel();
let obj = JSON.parse(JSON.stringify(this.record.get({ plain: true })));
for (let key in obj) {
if (!model.tableAttributes[key]) continue;
if (model.tableAttributes[key].type instanceof Sequelize.JSON && typeof obj[key] === 'string') {
try {
this[key] = JSON.parse(obj[key]);

2
models/contest_ranklist.js

@ -53,6 +53,8 @@ class ContestRanklist extends Model {
for (let i in player.score_details) {
let judge_state = await JudgeState.fromID(player.score_details[i].judge_id);
if (!judge_state) continue;
player.latest = Math.max(player.latest, judge_state.submit_time);
if (player.score_details[i].score != null) {

Loading…
Cancel
Save