Fix one bug and change script name
This commit is contained in:
parent
87e7a2a6d1
commit
1f57ea371d
|
@ -43,7 +43,7 @@ async function recalculateContract(contractRef: DocRef, contract: Contract) {
|
|||
console.log()
|
||||
}
|
||||
|
||||
async function migrateContracts() {
|
||||
async function recalculateContractTotals() {
|
||||
console.log('Recalculating contract info')
|
||||
|
||||
const snapshot = await firestore.collection('contracts').get()
|
||||
|
@ -58,4 +58,5 @@ async function migrateContracts() {
|
|||
}
|
||||
}
|
||||
|
||||
if (require.main === module) migrateContracts().then(() => process.exit())
|
||||
if (require.main === module)
|
||||
recalculateContractTotals().then(() => process.exit())
|
|
@ -51,7 +51,7 @@ export function calculatePayout(
|
|||
const startPool = contract.startPool.YES + contract.startPool.NO
|
||||
const truePool = contract.pool.YES + contract.pool.NO - startPool
|
||||
|
||||
if (totalBets[outcome] <= truePool)
|
||||
if (totalBets[outcome] >= truePool)
|
||||
return (amount / totalBets[outcome]) * truePool
|
||||
|
||||
const total = totalShares[outcome] - totalBets[outcome]
|
||||
|
|
Loading…
Reference in New Issue
Block a user