Fix loan calc on front end
This commit is contained in:
parent
5bf4654bf4
commit
45d322cfd3
|
@ -38,7 +38,8 @@ export function AmountInput(props: {
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
|
||||||
const userBets = useUserContractBets(user?.id, contractId) ?? []
|
const userBets = useUserContractBets(user?.id, contractId) ?? []
|
||||||
const prevLoanAmount = _.sumBy(userBets, (bet) => bet.loanAmount ?? 0)
|
const openUserBets = userBets.filter((bet) => !bet.isSold && !bet.sale)
|
||||||
|
const prevLoanAmount = _.sumBy(openUserBets, (bet) => bet.loanAmount ?? 0)
|
||||||
|
|
||||||
const loanAmount = Math.min(
|
const loanAmount = Math.min(
|
||||||
amount ?? 0,
|
amount ?? 0,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user