From d2462620da2900b83e6b36d1016735e54f90d519 Mon Sep 17 00:00:00 2001 From: Menci Date: Sat, 13 Apr 2019 18:47:24 +0800 Subject: [PATCH] Fix error when ranking_params is null --- modules/contest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/contest.js b/modules/contest.js index fd2f4f0..763d3d8 100644 --- a/modules/contest.js +++ b/modules/contest.js @@ -249,7 +249,7 @@ app.get('/contest/:id/ranklist', async (req, res) => { /*** XXX: Clumsy duplication, see ContestRanklist::updatePlayer() ***/ 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 += player.score_details[i].weighted_score; }