Exclude sold bets from current loan amount
This commit is contained in:
parent
d5ae4a2377
commit
1da30812ad
|
@ -103,7 +103,8 @@ export const getNewMultiBetInfo = (
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getLoanAmount = (yourBets: Bet[], newBetAmount: number) => {
|
export const getLoanAmount = (yourBets: Bet[], newBetAmount: number) => {
|
||||||
const prevLoanAmount = _.sumBy(yourBets, (bet) => bet.loanAmount ?? 0)
|
const openBets = yourBets.filter((bet) => !bet.isSold && !bet.sale)
|
||||||
|
const prevLoanAmount = _.sumBy(openBets, (bet) => bet.loanAmount ?? 0)
|
||||||
const loanAmount = Math.min(
|
const loanAmount = Math.min(
|
||||||
newBetAmount,
|
newBetAmount,
|
||||||
MAX_LOAN_PER_CONTRACT - prevLoanAmount
|
MAX_LOAN_PER_CONTRACT - prevLoanAmount
|
||||||
|
|
Loading…
Reference in New Issue
Block a user