From 77b2cc72677c1ca1fde8269056db1e2b6ed52d84 Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 21 Jan 2021 19:01:31 +0000 Subject: [PATCH] catch any errors while updating val graph value, graph starts hidden and fades in on complete --- src/js/tribe.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/js/tribe.js b/src/js/tribe.js index ec2265485..d50ca1377 100644 --- a/src/js/tribe.js +++ b/src/js/tribe.js @@ -275,7 +275,7 @@ function mp_refreshTestUserList() {
-
+ @@ -479,13 +479,17 @@ function mp_scrollChat() { } function updateAllGraphs(graphs, max) { - graphs.forEach((graph) => { - if (graph.options.scales.yAxes[0].ticks.max < Math.round(max)) { - graph.options.scales.yAxes[0].ticks.max = Math.round(max); - graph.options.scales.yAxes[1].ticks.max = Math.round(max); - } - graph.update({ duration: 0 }); - }); + try { + graphs.forEach((graph) => { + if (graph.options.scales.yAxes[0].ticks.max < Math.round(max)) { + graph.options.scales.yAxes[0].ticks.max = Math.round(max); + graph.options.scales.yAxes[1].ticks.max = Math.round(max); + } + graph.update({ duration: 0 }); + }); + } catch (e) { + console.error("Something went wrong while updating max graph values " + e); + } } function drawMinigraph(sid, result) { @@ -862,8 +866,10 @@ MP.socket.on("mp_room_user_finished", (data) => { drawMinigraph(data.socketId, data.result); - $(`.tribeResult table .player[socketId=${data.socketId}] .progress`).addClass( - "hidden" + swapElements( + $(`.tribeResult table .player[socketId=${data.socketId}] .progress`), + $(`.tribeResult table .player[socketId=${data.socketId}] .graph`), + 250 ); if (config.mode !== "time" && !data.result.failed && !data.result.afk) {