Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sairaj-mote committed Nov 13, 2023
1 parent 78ff09b commit 0798a5b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1638,13 +1638,26 @@ <h5 class="label">Incorporation address</h5>
// 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) {
Expand Down

0 comments on commit 0798a5b

Please sign in to comment.