From 78ff09ba37ab5145956e1e076d8df3164c95d66e Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Mon, 13 Nov 2023 19:37:47 +0530 Subject: [PATCH 1/2] fixed contract participants not shown issue --- index.html | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index cde14e9..52c07c2 100644 --- a/index.html +++ b/index.html @@ -1638,19 +1638,13 @@
Incorporation address
// Consolidate participants with same address and choice const consolidatedParticipants = {} for (const participant in contractParticipants) { - const { participantFloAddress, tokenAmount, tokenIdentification, transactionHash, userChoice, winningAmount } = contractParticipants[participant] - if (!consolidatedParticipants[`${participantFloAddress}-${userChoice}`]) { - consolidatedParticipants[`${participantFloAddress}-${userChoice}`] = { - participantFloAddress, - tokenAmount, - tokenIdentification, - transactionHash, - userChoice, - winningAmount - } + const { participantFloAddress, tokenAmount, userChoice, winningAmount } = contractParticipants[participant] + const id = userChoice ? `${participantFloAddress}-${userChoice}` : participantFloAddress + if (!consolidatedParticipants[id]) { + consolidatedParticipants[id] = contractParticipants[participant] } else { - consolidatedParticipants[`${participantFloAddress}-${userChoice}`].tokenAmount += tokenAmount - consolidatedParticipants[`${participantFloAddress}-${userChoice}`].winningAmount += winningAmount + consolidatedParticipants[id].tokenAmount += tokenAmount + consolidatedParticipants[id].winningAmount += winningAmount } } for (const participant in consolidatedParticipants) { From 0798a5bd89e545bfecdf249fc69628b58f3d970b Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Mon, 13 Nov 2023 19:47:50 +0530 Subject: [PATCH 2/2] 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) {