Fix trades sort by newest

This commit is contained in:
James Grugett 2022-02-21 12:42:51 -06:00
parent 207a12df55
commit c32442ab41

View File

@ -110,7 +110,13 @@ export function BetsList(props: { user: User }) {
)
} else if (sort === 'value') {
sortedContracts = _.sortBy(contracts, (c) => -contractsCurrentValue[c.id])
}
} else if (sort === 'newest')
sortedContracts = _.sortBy(
contracts,
(c) => -1 * Math.max(...contractBets[c.id].map((bet) => bet.createdTime))
)
else if (sort === 'resolved')
sortedContracts = _.sortBy(contracts, (c) => -1 * (c.resolutionTime ?? 0))
const [resolved, unresolved] = _.partition(
sortedContracts,