From db7eee495cb9fa3a4b2c18948bc4ea5bdbdeba8b Mon Sep 17 00:00:00 2001 From: James Grugett Date: Mon, 14 Mar 2022 19:39:40 -0500 Subject: [PATCH] Answer group feed: Always include answer of last bet. --- web/components/feed/activity-items.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/web/components/feed/activity-items.ts b/web/components/feed/activity-items.ts index a3d42f2f..08ae0178 100644 --- a/web/components/feed/activity-items.ts +++ b/web/components/feed/activity-items.ts @@ -188,11 +188,16 @@ function getAnswerGroups( const lastCommentOutcome = bets.find( (bet) => bet.id === lastComment?.betId )?.outcome - if (lastCommentOutcome) { - outcomes = [ - ...outcomes.filter((outcome) => outcome !== lastCommentOutcome), + const lastBetOutcome = _.last(bets)?.outcome + if (lastCommentOutcome && lastBetOutcome) { + outcomes = _.uniq([ + ...outcomes.filter( + (outcome) => + outcome !== lastCommentOutcome && outcome !== lastBetOutcome + ), lastCommentOutcome, - ] + lastBetOutcome, + ]) } outcomes = outcomes.slice(-2) }