Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated #682

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
},
}
}