Handle floating point precision in max shares you can sell.
This commit is contained in:
parent
d772a20d5e
commit
74fe80fd42
|
@ -61,7 +61,7 @@ export const sellShares = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||||
]
|
]
|
||||||
|
|
||||||
const maxShares = outcome === 'YES' ? yesShares : noShares
|
const maxShares = outcome === 'YES' ? yesShares : noShares
|
||||||
if (shares > maxShares) {
|
if (shares > maxShares + 0.000000000001) {
|
||||||
return {
|
return {
|
||||||
status: 'error',
|
status: 'error',
|
||||||
message: `You can only sell ${maxShares} shares`,
|
message: `You can only sell ${maxShares} shares`,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user