Skip to content

Commit

Permalink
feat: add per-ecosystem amount distribution for debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
swimricky committed Nov 16, 2023
1 parent 75a7548 commit cbbab90
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion frontend/scripts/populate_from_csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,24 @@ async function main() {
const [maxEcoUser, maxEcoAmount] = getMaxUserAndAmount(
claimInfos.filter((claimInfo) => claimInfo.ecosystem === ecosystem)
)
const ecoAmounts = claimInfos
.filter((claimInfo) => claimInfo.ecosystem === ecosystem)
.reduce((acc, curr) => {
const amountCount = acc.get(curr.amount.toNumber()) ?? 0
acc.set(curr.amount.toNumber(), amountCount + 1)
return acc
}, new Map<number, number>()) //map <amount, count>
const ecoAmountsArr = Array.from(ecoAmounts.entries())
ecoAmountsArr.sort((a, b) => {
return b[0] - a[0]
})

console.log(
`ecosystem: ${ecosystem} maxEcoUser: ${maxEcoUser} maxEcoAmount: ${maxEcoAmount
.div(new BN(1000000))
.toString()}`
.toString()}
ecoAmountsArr: ${JSON.stringify(ecoAmountsArr)}
`
)
})
const ecosystemMap = getTotalByEcosystems(claimInfos)
Expand Down

0 comments on commit cbbab90

Please sign in to comment.