Skip to content

Commit c167da6

Browse files
authored
Merge pull request #222 from topcoder-platform/issue-4749
Fix challenge.track validation
2 parents 1f69bae + 7cca2af commit c167da6

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/reducers/challenge.js

+3-1
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

+2-2
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

+1-1
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)