From 4de4c322f27087ae42d7b266c09fee8fb2c2c697 Mon Sep 17 00:00:00 2001 From: sr_jr Date: Tue, 26 May 2020 12:30:43 +0530 Subject: [PATCH] fix for issue #4407 --- src/services/challenges.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index a7cdaf3f..5c6f830e 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -30,11 +30,16 @@ export const ORDER_BY = { */ export function normalizeChallenge(challenge, username) { const phases = challenge.allPhases || challenge.phases || []; - let registrationOpen = phases.filter(d => d.name === 'Registration')[0]; - if (registrationOpen && registrationOpen.isOpen) { - registrationOpen = 'Yes'; - } else { - registrationOpen = 'No'; + const registration = phases.filter(d => d.name === 'Registration')[0]; + let registrationOpen = 'No'; + let registrationStartDate; + let registrationEndDate; + if (registration) { + registrationStartDate = registration.actualStartDate || registration.scheduledStartDate; + if (registration.isOpen) { + registrationOpen = 'Yes'; + } + registrationEndDate = registration.actualEndDate || registration.scheduledEndDate; } const groups = {}; if (challenge.groups) { @@ -56,11 +61,16 @@ export function normalizeChallenge(challenge, username) { if (submissionEndTimestamp) { submissionEndTimestamp = submissionEndTimestamp.scheduledEndDate; } + const prizes = (challenge.prizeSets[0] && challenge.prizeSets[0].prizes) || []; _.defaults(challenge, { communities: new Set([COMPETITION_TRACKS[challenge.legacy.track]]), groups, registrationOpen, submissionEndTimestamp, + registrationStartDate, + registrationEndDate, + totalPrize: prizes.reduce((acc, prize) => acc + prize.value, 0), + submissionEndDate: submissionEndTimestamp, users: username ? { [username]: true } : {}, }); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy