fixed contract participants not shown issue
This commit is contained in:
parent
62e7f8b20a
commit
78ff09ba37
18
index.html
18
index.html
@ -1638,19 +1638,13 @@
|
|||||||
// Consolidate participants with same address and choice
|
// Consolidate participants with same address and choice
|
||||||
const consolidatedParticipants = {}
|
const consolidatedParticipants = {}
|
||||||
for (const participant in contractParticipants) {
|
for (const participant in contractParticipants) {
|
||||||
const { participantFloAddress, tokenAmount, tokenIdentification, transactionHash, userChoice, winningAmount } = contractParticipants[participant]
|
const { participantFloAddress, tokenAmount, userChoice, winningAmount } = contractParticipants[participant]
|
||||||
if (!consolidatedParticipants[`${participantFloAddress}-${userChoice}`]) {
|
const id = userChoice ? `${participantFloAddress}-${userChoice}` : participantFloAddress
|
||||||
consolidatedParticipants[`${participantFloAddress}-${userChoice}`] = {
|
if (!consolidatedParticipants[id]) {
|
||||||
participantFloAddress,
|
consolidatedParticipants[id] = contractParticipants[participant]
|
||||||
tokenAmount,
|
|
||||||
tokenIdentification,
|
|
||||||
transactionHash,
|
|
||||||
userChoice,
|
|
||||||
winningAmount
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
consolidatedParticipants[`${participantFloAddress}-${userChoice}`].tokenAmount += tokenAmount
|
consolidatedParticipants[id].tokenAmount += tokenAmount
|
||||||
consolidatedParticipants[`${participantFloAddress}-${userChoice}`].winningAmount += winningAmount
|
consolidatedParticipants[id].winningAmount += winningAmount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const participant in consolidatedParticipants) {
|
for (const participant in consolidatedParticipants) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user