From 43d3662db10b6c301f79e8adcd76dbba079d6a3a Mon Sep 17 00:00:00 2001 From: mantikoros Date: Mon, 2 May 2022 12:16:29 -0400 Subject: [PATCH] fixed negative shares bug --- web/components/use-save-shares.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/web/components/use-save-shares.ts b/web/components/use-save-shares.ts index 467e19ae..c67ea9c9 100644 --- a/web/components/use-save-shares.ts +++ b/web/components/use-save-shares.ts @@ -26,10 +26,8 @@ export const useSaveShares = ( _.sumBy(noBets, (bet) => bet.shares), ] - const [yesFloorShares, noFloorShares] = [ - Math.floor(yesShares), - Math.floor(noShares), - ] + const yesFloorShares = Math.round(yesShares) === 0 ? 0 : Math.floor(yesShares) + const noFloorShares = Math.round(noShares) === 0 ? 0 : Math.floor(noShares) useEffect(() => { // Save yes and no shares to local storage.