Home: Don't show duplicate contracts across groups

This commit is contained in:
James Grugett 2022-10-03 18:28:41 -05:00
parent 8d70dc4800
commit efd83eaad4

View File

@ -233,14 +233,20 @@ function renderGroupSections(
)
).reverse()
const previouslySeenContracts = new Set<string>()
return (
<>
{orderedGroups.map((group) => {
const contracts = groupContracts[group.slug].filter(
(c) => Math.abs(c.probChanges.day) >= 0.01
(c) =>
Math.abs(c.probChanges.day) >= 0.01 &&
!previouslySeenContracts.has(c.id)
)
if (contracts.length === 0) return null
contracts.forEach((c) => previouslySeenContracts.add(c.id))
return (
<GroupSection
key={group.id}