From d18dd5b8fbbb4cbefd508141557e59650dfb72b1 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Sun, 21 Aug 2022 15:58:49 -0500 Subject: [PATCH] Fix a case of limit order sorting --- web/components/limit-bets.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/components/limit-bets.tsx b/web/components/limit-bets.tsx index a3cd7973..466b7a9b 100644 --- a/web/components/limit-bets.tsx +++ b/web/components/limit-bets.tsx @@ -163,13 +163,15 @@ export function OrderBookButton(props: { const { limitBets, contract, className } = props const [open, setOpen] = useState(false) - const yesBets = sortBy( - limitBets.filter((bet) => bet.outcome === 'YES'), + const sortedBets = sortBy( + limitBets, (bet) => -1 * bet.limitProb, (bet) => bet.createdTime ) + + const yesBets = sortedBets.filter((bet) => bet.outcome === 'YES') const noBets = sortBy( - limitBets.filter((bet) => bet.outcome === 'NO'), + sortedBets.filter((bet) => bet.outcome === 'NO'), (bet) => bet.limitProb, (bet) => bet.createdTime ) @@ -202,7 +204,7 @@ export function OrderBookButton(props: {