Skip to content

Fix challenge.track validation #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/reducers/challenge.js
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@ import { fireErrorMessage } from '../utils/errors';

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

import { COMPETITION_TRACKS } from '../utils/tc';

/**
* Handles CHALLENGE/GET_DETAILS_INIT action.
* @param {Object} state
@@ -469,7 +471,7 @@ export function factory(options = {}) {
const challengeDetails = _.get(res, 'payload', {});
const track = _.get(challengeDetails, 'legacy.track', '');
let checkpointsPromise = null;
if (track === 'DESIGN') {
if (track === COMPETITION_TRACKS.DESIGN) {
const p = _.get(challengeDetails, 'phases', [])
.filter(x => x.name === 'Checkpoint Review');
if (p.length && !p[0].isOpen) {
4 changes: 2 additions & 2 deletions src/services/challenges.js
Original file line number Diff line number Diff line change
@@ -636,7 +636,7 @@ class ChallengesService {
let contentType;
let url;

if (track === 'DESIGN') {
if (track === COMPETITION_TRACKS.DESIGN) {
({ api } = this.private);
contentType = 'application/json';
url = '/submissions/'; // The submission info is contained entirely in the JSON body
@@ -654,7 +654,7 @@ class ChallengesService {
}, onProgress).then((res) => {
const jres = JSON.parse(res);
// Return result for Develop submission
if (track === 'DEVELOP') {
if (track === COMPETITION_TRACKS.DEVELOP) {
return jres;
}
// Design Submission requires an extra "Processing" POST
2 changes: 1 addition & 1 deletion src/utils/challenge/filter.js
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ function filterByRegistrationOpen(challenge, state) {
if (!registrationPhase || !registrationPhase.isOpen) {
return false;
}
if (challenge.track === 'DESIGN') {
if (challenge.track === COMPETITION_TRACKS.DESIGN) {
const checkpointPhase = challengePhases.find(item => item.name === 'Checkpoint Submission')[0];
return !checkpointPhase || !checkpointPhase.isOpen;
}