Skip to content

Commit 0a44b2e

Browse files
luizrrodriguesmtwomey
authored andcommitted
Fix challenge.track validation
1 parent 61b7e18 commit 0a44b2e

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/reducers/challenge.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import { fireErrorMessage } from '../utils/errors';
1818

1919
import mySubmissionsManagement from './my-submissions-management';
2020

21+
import { COMPETITION_TRACKS } from '../utils/tc';
22+
2123
/**
2224
* Handles CHALLENGE/GET_DETAILS_INIT action.
2325
* @param {Object} state
@@ -469,7 +471,7 @@ export function factory(options = {}) {
469471
const challengeDetails = _.get(res, 'payload', {});
470472
const track = _.get(challengeDetails, 'legacy.track', '');
471473
let checkpointsPromise = null;
472-
if (track === 'DESIGN') {
474+
if (track === COMPETITION_TRACKS.DESIGN) {
473475
const p = _.get(challengeDetails, 'phases', [])
474476
.filter(x => x.name === 'Checkpoint Review');
475477
if (p.length && !p[0].isOpen) {

src/services/challenges.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ class ChallengesService {
636636
let contentType;
637637
let url;
638638

639-
if (track === 'DESIGN') {
639+
if (track === COMPETITION_TRACKS.DESIGN) {
640640
({ api } = this.private);
641641
contentType = 'application/json';
642642
url = '/submissions/'; // The submission info is contained entirely in the JSON body
@@ -654,7 +654,7 @@ class ChallengesService {
654654
}, onProgress).then((res) => {
655655
const jres = JSON.parse(res);
656656
// Return result for Develop submission
657-
if (track === 'DEVELOP') {
657+
if (track === COMPETITION_TRACKS.DEVELOP) {
658658
return jres;
659659
}
660660
// Design Submission requires an extra "Processing" POST

src/utils/challenge/filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function filterByRegistrationOpen(challenge, state) {
8989
if (!registrationPhase || !registrationPhase.isOpen) {
9090
return false;
9191
}
92-
if (challenge.track === 'DESIGN') {
92+
if (challenge.track === COMPETITION_TRACKS.DESIGN) {
9393
const checkpointPhase = challengePhases.find(item => item.name === 'Checkpoint Submission')[0];
9494
return !checkpointPhase || !checkpointPhase.isOpen;
9595
}

0 commit comments

Comments
 (0)
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