Browse Source

Improve robustness

pull/6/head
Menci 6 years ago
parent
commit
fb3c5a23eb
  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