Skip to content

Hotfix - Remove old legacy.track #224

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

Open
wants to merge 6 commits into
base: integration-v5-challenge-api
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix challenge.track validation
  • Loading branch information
luizrrodrigues committed Aug 14, 2020
commit 7cca2afb54e725f0b1f7f29afdb138aa8cdccc1c
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;
}