Skip to content

Commit

Permalink
fixed contract participants not shown issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sairaj-mote committed Nov 13, 2023
1 parent 62e7f8b commit 78ff09b
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1638,19 +1638,13 @@ <h5 class="label">Incorporation address</h5>
// 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) {
Expand Down

0 comments on commit 78ff09b

Please sign in to comment.