Browse Source

Fix error when ranking_params is null

pull/6/head
Menci 6 years ago
parent
commit
d2462620da
  1. 2
      modules/contest.js

2
modules/contest.js

@ -249,7 +249,7 @@ app.get('/contest/:id/ranklist', async (req, res) => {
/*** XXX: Clumsy duplication, see ContestRanklist::updatePlayer() ***/ /*** XXX: Clumsy duplication, see ContestRanklist::updatePlayer() ***/
if (contest.type === 'noi' || contest.type === 'ioi') { if (contest.type === 'noi' || contest.type === 'ioi') {
let multiplier = contest.ranklist.ranking_params[i] || 1.0; let multiplier = (contest.ranklist.ranking_params || {})[i] || 1.0;
player.score_details[i].weighted_score = player.score_details[i].score == null ? null : Math.round(player.score_details[i].score * multiplier); player.score_details[i].weighted_score = player.score_details[i].score == null ? null : Math.round(player.score_details[i].score * multiplier);
player.score += player.score_details[i].weighted_score; player.score += player.score_details[i].weighted_score;
} }

Loading…
Cancel
Save