diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b1904184..4bcd34dfe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -180,6 +180,7 @@ workflows: only: - develop - PM-3087_virus-scan-fix + - PM-3541_home-points-challenge - "build-prod": context: org-global diff --git a/src/shared/components/Dashboard/Challenges/index.jsx b/src/shared/components/Dashboard/Challenges/index.jsx index b9ae24631..251c2b3c9 100644 --- a/src/shared/components/Dashboard/Challenges/index.jsx +++ b/src/shared/components/Dashboard/Challenges/index.jsx @@ -38,26 +38,32 @@ export default function ChallengesFeed({ ) : ( - (challenges || []).map(challenge => ( -
- - {challenge.name} - -
- - {`$${_.sum( - challenge.prizeSets - .filter(set => set.type === 'PLACEMENT') - .map(item => _.sum(item.prizes.map(prize => prize.value))), - ).toLocaleString()}`} - + (challenges || []).map((challenge) => { + const placementPrizes = challenge.prizeSets + .filter(set => set.type === 'PLACEMENT') + .flatMap(item => item.prizes); + const prizeTotal = _.sum(placementPrizes.map(prize => prize.value)); + const prizeType = placementPrizes.length > 0 ? placementPrizes[0].type : null; + const isPointBasedPrize = prizeType === 'POINT'; + const prizeSymbol = isPointBasedPrize ? '' : '$'; + + return ( +
+ + {challenge.name} + +
+ + {`${prizeSymbol}${prizeTotal.toLocaleString()}`} + +
-
- )) + ); + }) )}