Answer group feed: Always include answer of last bet.

This commit is contained in:
James Grugett 2022-03-14 19:39:40 -05:00
parent a82b3577d4
commit db7eee495c

View File

@ -188,11 +188,16 @@ function getAnswerGroups(
const lastCommentOutcome = bets.find( const lastCommentOutcome = bets.find(
(bet) => bet.id === lastComment?.betId (bet) => bet.id === lastComment?.betId
)?.outcome )?.outcome
if (lastCommentOutcome) { const lastBetOutcome = _.last(bets)?.outcome
outcomes = [ if (lastCommentOutcome && lastBetOutcome) {
...outcomes.filter((outcome) => outcome !== lastCommentOutcome), outcomes = _.uniq([
...outcomes.filter(
(outcome) =>
outcome !== lastCommentOutcome && outcome !== lastBetOutcome
),
lastCommentOutcome, lastCommentOutcome,
] lastBetOutcome,
])
} }
outcomes = outcomes.slice(-2) outcomes = outcomes.slice(-2)
} }