@@ -1283,7 +1283,6 @@ async function getChallenge(currentUser, id, checkIfExists) {
1283
1283
if ( challenge . status !== constants . challengeStatuses . Completed ) {
1284
1284
_ . unset ( challenge , "winners" ) ;
1285
1285
}
1286
- convertPrizeSetValuesToDollars ( challenge . prizeSets , challenge . overview ) ;
1287
1286
1288
1287
return challenge ;
1289
1288
}
@@ -1410,6 +1409,7 @@ async function validateWinners(winners, challengeId) {
1410
1409
*/
1411
1410
async function updateChallenge ( currentUser , challengeId , data ) {
1412
1411
const challenge = await challengeDomain . lookup ( getLookupCriteria ( "id" , challengeId ) ) ;
1412
+ convertPrizeSetValuesToDollars ( challenge . prizeSets , challenge . overview ) ;
1413
1413
1414
1414
const projectId = _ . get ( challenge , "projectId" ) ;
1415
1415
@@ -1641,20 +1641,6 @@ async function updateChallenge(currentUser, challengeId, data) {
1641
1641
`Cannot update prizeSets for challenges with status: ${ finalStatus } !`
1642
1642
) ;
1643
1643
}
1644
- const prizeSetsGroup = _ . groupBy ( data . prizeSets , "type" ) ;
1645
- if (
1646
- ! prizeSetsGroup [ constants . prizeSetTypes . ChallengePrizes ] &&
1647
- _ . get ( challenge , "overview.totalPrizes" )
1648
- ) {
1649
- // remove the totalPrizes if challenge prizes are empty
1650
- data . overview = challenge . overview = _ . omit ( challenge . overview , [ "totalPrizes" ] ) ;
1651
- } else {
1652
- const totalPrizes = helper . sumOfPrizes (
1653
- prizeSetsGroup [ constants . prizeSetTypes . ChallengePrizes ] [ 0 ] . prizes
1654
- ) ;
1655
- _ . assign ( challenge , { overview : { totalPrizes } } ) ;
1656
- _ . assign ( data , { overview : { totalPrizes } } ) ;
1657
- }
1658
1644
}
1659
1645
1660
1646
let phasesUpdated = false ;
0 commit comments