@@ -1298,7 +1298,6 @@ async function getChallenge(currentUser, id, checkIfExists) {
1298
1298
if ( challenge . status !== constants . challengeStatuses . Completed ) {
1299
1299
_ . unset ( challenge , "winners" ) ;
1300
1300
}
1301
- convertPrizeSetValuesToDollars ( challenge . prizeSets , challenge . overview ) ;
1302
1301
1303
1302
return challenge ;
1304
1303
}
@@ -1425,6 +1424,7 @@ async function validateWinners(winners, challengeId) {
1425
1424
*/
1426
1425
async function updateChallenge ( currentUser , challengeId , data ) {
1427
1426
const challenge = await challengeDomain . lookup ( getLookupCriteria ( "id" , challengeId ) ) ;
1427
+ convertPrizeSetValuesToDollars ( challenge . prizeSets , challenge . overview ) ;
1428
1428
1429
1429
const projectId = _ . get ( challenge , "projectId" ) ;
1430
1430
@@ -1651,20 +1651,6 @@ async function updateChallenge(currentUser, challengeId, data) {
1651
1651
`Cannot update prizeSets for challenges with status: ${ finalStatus } !`
1652
1652
) ;
1653
1653
}
1654
- const prizeSetsGroup = _ . groupBy ( data . prizeSets , "type" ) ;
1655
- if (
1656
- ! prizeSetsGroup [ constants . prizeSetTypes . ChallengePrizes ] &&
1657
- _ . get ( challenge , "overview.totalPrizes" )
1658
- ) {
1659
- // remove the totalPrizes if challenge prizes are empty
1660
- data . overview = challenge . overview = _ . omit ( challenge . overview , [ "totalPrizes" ] ) ;
1661
- } else {
1662
- const totalPrizes = helper . sumOfPrizes (
1663
- prizeSetsGroup [ constants . prizeSetTypes . ChallengePrizes ] [ 0 ] . prizes
1664
- ) ;
1665
- _ . assign ( challenge , { overview : { totalPrizes } } ) ;
1666
- _ . assign ( data , { overview : { totalPrizes } } ) ;
1667
- }
1668
1654
}
1669
1655
1670
1656
let phasesUpdated = false ;
0 commit comments