From b0424a519c14d913413219aa6d5838fcd3d6c986 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sat, 20 Feb 2021 13:57:39 +0100 Subject: [PATCH] Fixed drawing winner count was +1. On /lottery frontend page the count of winners that is sent to frontend over socketIO started one index higher than it should. This was from updating how winners are saved in the backend. Our winners array now no longer needs to be incremented with 1 from the backend. --- api/controllers/lotteryController.js | 2 +- frontend/ui/WinnerDraw.vue | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/api/controllers/lotteryController.js b/api/controllers/lotteryController.js index 199548c..5c62e93 100644 --- a/api/controllers/lotteryController.js +++ b/api/controllers/lotteryController.js @@ -9,7 +9,7 @@ const drawWinner = (req, res) => { io.emit("winner", { color: color, name: winner.name, - winner_count: winners.length + 1 + winner_count: winners.length }); return { winner, color, winners }; diff --git a/frontend/ui/WinnerDraw.vue b/frontend/ui/WinnerDraw.vue index 058bb1d..4501b55 100644 --- a/frontend/ui/WinnerDraw.vue +++ b/frontend/ui/WinnerDraw.vue @@ -146,7 +146,6 @@ export default { var timeLeft = animationEnd - Date.now(); if (timeLeft <= 0) { self.drawing = false; - console.time("drawing finished"); return clearInterval(interval); } if (currentName == "Amund Brandsrud") {