From 0798a5bd89e545bfecdf249fc69628b58f3d970b Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Mon, 13 Nov 2023 19:47:50 +0530 Subject: [PATCH] Bug fix --- index.html | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 52c07c2..c16ea25 100644 --- a/index.html +++ b/index.html @@ -1638,13 +1638,26 @@
Incorporation address
// Consolidate participants with same address and choice const consolidatedParticipants = {} for (const participant in contractParticipants) { - const { participantFloAddress, tokenAmount, userChoice, winningAmount } = contractParticipants[participant] + const { participantFloAddress, tokenAmount, userChoice, winningAmount, participationAmount } = contractParticipants[participant] const id = userChoice ? `${participantFloAddress}-${userChoice}` : participantFloAddress if (!consolidatedParticipants[id]) { consolidatedParticipants[id] = contractParticipants[participant] } else { - consolidatedParticipants[id].tokenAmount += tokenAmount - consolidatedParticipants[id].winningAmount += winningAmount + if (tokenAmount) { + if (!consolidatedParticipants[id].tokenAmount) + consolidatedParticipants[id].tokenAmount = 0 + consolidatedParticipants[id].tokenAmount += tokenAmount + } + if (participationAmount) { + if (!consolidatedParticipants[id].participationAmount) + consolidatedParticipants[id].participationAmount = 0 + consolidatedParticipants[id].participationAmount += participationAmount + } + if (winningAmount) { + if (!consolidatedParticipants[id].winningAmount) + consolidatedParticipants[id].winningAmount = 0 + consolidatedParticipants[id].winningAmount += winningAmount + } } } for (const participant in consolidatedParticipants) {