From 0a44b2e2ffde93327b99b8c25e0d9093016535fb Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Thu, 13 Aug 2020 21:44:51 -0300 Subject: [PATCH 1/4] Fix challenge.track validation --- src/reducers/challenge.js | 4 +++- src/services/challenges.js | 4 ++-- src/utils/challenge/filter.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index 05bb9bc9..e91c4f53 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -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) { diff --git a/src/services/challenges.js b/src/services/challenges.js index f24bdf5e..d5fb3bc2 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -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 diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 36e91e6f..263c3132 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -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; } From d5ba25f0999d1c673ea44f43cca97507236d29e0 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Aug 2020 23:06:11 -0500 Subject: [PATCH 2/4] fix: for #4749 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6559a5cf..31d4b3a4 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .", "test": "npm run lint && npm run jest" }, - "version": "1000.19.44", + "version": "1000.19.46", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From f39c0120820db39cc259ab27c48e454281921c87 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 14 Aug 2020 00:20:28 -0500 Subject: [PATCH 3/4] Fix getChallengeRegistrants filter to not logged user Also update to version 100.19.47 --- package.json | 2 +- src/services/challenges.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 31d4b3a4..d8b4e042 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .", "test": "npm run lint && npm run jest" }, - "version": "1000.19.46", + "version": "1000.19.47", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", diff --git a/src/services/challenges.js b/src/services/challenges.js index d5fb3bc2..d0a298ae 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -407,7 +407,9 @@ class ChallengesService { .then(checkErrorV5).then(res => res.result); /* API will return all roles to currentUser, so need to filter in FE */ - registrants = _.filter(registrants, r => r.roleId === roleId); + if (roleId) { + registrants = _.filter(registrants, r => r.roleId === roleId); + } return registrants || []; } From cebfd8b2f3afb9dd21c99ec4900145a9496637be Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 15 Aug 2020 23:55:37 -0500 Subject: [PATCH 4/4] Hotfix - Remove old legacy.track Also update version to 1000.19.48 --- package.json | 2 +- src/reducers/challenge.js | 2 +- src/services/challenges.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d8b4e042..688904c8 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .", "test": "npm run lint && npm run jest" }, - "version": "1000.19.47", + "version": "1000.19.48", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index e91c4f53..7fb1dbd9 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -469,7 +469,7 @@ export function factory(options = {}) { tokens.tokenV2, )).then((res) => { const challengeDetails = _.get(res, 'payload', {}); - const track = _.get(challengeDetails, 'legacy.track', ''); + const track = _.get(challengeDetails, 'track', ''); let checkpointsPromise = null; if (track === COMPETITION_TRACKS.DESIGN) { const p = _.get(challengeDetails, 'phases', []) diff --git a/src/services/challenges.js b/src/services/challenges.js index d0a298ae..fd0fecec 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -59,7 +59,7 @@ export function normalizeChallenge(challenge, username) { } const prizes = (challenge.prizeSets[0] && challenge.prizeSets[0].prizes) || []; _.defaults(challenge, { - communities: new Set([COMPETITION_TRACKS[challenge.legacy.track]]), + communities: new Set([COMPETITION_TRACKS[challenge.track]]), groups, registrationOpen, submissionEndTimestamp,