Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Campos de Teba authored and Ruben Campos de Teba committed Dec 6, 2023
1 parent 6f68385 commit e53ded5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
17 changes: 1 addition & 16 deletions src/components/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,7 @@ const Leaderboard = ({ openEditions, isWinner, count, totalSales, matchFundPoole
const { salesArtifacts, spli80, prize, totalAward, projectMatchFund, calculateMatchFundContribution } =
calculateSales(isWinner, matchFundPooled, count, totalSales)

// const salesArtifacts = BASE_ARTIFACT_PRICE * count

// //add match to matchFundPooled
// const spli80 = (80 * matchFundPooled) / 100
// //only winners get 20% of the match fund on top of their sales
// const split20 = (20 * matchFundPooled) / 100

// const getMatchFundMoney = (countH: number): number => {
// const split = totalSales > 0 ? (countH * 100) / totalSales : 0
// console.log('this project split is: ', split)
// //split: 6*100/8 = 75%
// //spli80: 80*10/100 = 8
// return (spli80 * split) / 100
// }

// const sells = (salesArtifacts + getMatchFundMoney(count) + salesArtifacts + (isWinner ? split20 : 0)).toFixed(2)


const title = (
<div>
Expand Down
15 changes: 8 additions & 7 deletions src/lib/calculateSales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ export const calculateSales = (isWinner: boolean, matchFundPooled: number, count

const totalProjectSales = getSalesArtifacts(count)

const spli80 = (80 * matchFundPooled) / 100
const split20 = (20 * matchFundPooled) / 100
const projectMatchFund = getMatchFundMoney(totalSales, count, spli80)
const spli90 = (90 * matchFundPooled) / 100
const split10 = (10 * matchFundPooled) / 100
const projectMatchFund = getMatchFundMoney(totalSales, count, spli90)

const totalAward = (totalProjectSales + projectMatchFund + (isWinner ? split20 : 0)).toFixed(2)
const totalAward = (totalProjectSales + projectMatchFund + (isWinner ? split10 : 0)).toFixed(2)

return {
salesArtifacts: totalProjectSales,
projectMatchFund: projectMatchFund.toFixed(2),
spli80: spli80.toFixed(2),
prize: split20.toFixed(2),
spli80: spli90.toFixed(2),
prize: split10.toFixed(2),
totalAward,
calculateMatchFundContribution: (newCount: any) => {
return (getSalesArtifacts(newCount) + getMatchFundMoney(totalSales, newCount, spli80)).toFixed(2)
return (getMatchFundMoney(totalSales, newCount, spli90)).toFixed(2)
// return (getSalesArtifacts(newCount) + getMatchFundMoney(totalSales, newCount, spli90)).toFixed(2)
},
}
}

0 comments on commit e53ded5

Please sign in to comment.