From e7ee6d0b4473aa50149126a206dc4900d3025833 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 11 Aug 2020 17:17:06 -0300 Subject: [PATCH 01/14] Fix Open For Review changes filter --- src/services/reviewOpportunities.js | 30 ++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/services/reviewOpportunities.js b/src/services/reviewOpportunities.js index 51af9e44..820f5a46 100644 --- a/src/services/reviewOpportunities.js +++ b/src/services/reviewOpportunities.js @@ -8,19 +8,31 @@ import { getApi } from './api'; /** * Sync the fields of V3 and V5 for front-end to process successfully - * @param challenges - challenges to normalize + * @param opportunities - opportunities to normalize */ -export function normalizeChallenges(challenges) { - if (challenges) { - _.map(challenges, (ch) => { - const { challenge } = ch; - if (challenge.technologies && challenge.technologies.includes('Data Science')) { - challenge.track = 'DATA_SCIENCE'; +export function normalizeChallenges(opportunities) { + if (opportunities) { + /* Issue#4739 : Temporary add track to review opportunities challenges + * until receive API V5 update. */ + _.map(opportunities, (opportunity) => { + const { challenge } = opportunity; + challenge.track = 'Development'; + if (challenge.technologies) { + if (challenge.technologies.includes('Data Science')) { + challenge.track = 'Data Science'; + } else if (challenge.technologies.includes('QA')) { + challenge.track = 'Quality Assurance'; + } + } else if (challenge.subTrack === 'TEST_SUITES' || challenge.subTrack === 'BUG_HUNT') { + challenge.track = 'Quality Assurance'; + } else if (challenge.track === 'DESIGN') { + challenge.track = 'Design'; } - return _.defaults(ch, { challenge }); + return _.defaults(opportunity, { challenge }); }); } - return challenges; + + return opportunities; } /** From 100dcb704935ed44711805e0d4204ddb7e15f82c Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Tue, 18 Aug 2020 18:06:55 +0530 Subject: [PATCH 02/14] feat: v5 API integration --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 688904c8..e9654cb9 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.48", + "version": "1.0.0", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 4ee089d9ad8b9dfa84793bd2b36170eb7fa5d0da Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Tue, 18 Aug 2020 18:07:37 +0530 Subject: [PATCH 03/14] ci: removed dist tag --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e8eac28e..0e161844 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,7 +28,7 @@ jobs: - attach_workspace: at: . - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - - run: npm publish --tag test-release + - run: npm publish # dont change anything workflows: version: 2 From 65212c645f8d8efcd73721a18280ca393370443b Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 25 Aug 2020 02:01:33 -0300 Subject: [PATCH 04/14] Fix groupIds filter --- src/utils/challenge/filter.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 263c3132..31c28c5c 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -71,8 +71,9 @@ import { COMPETITION_TRACKS, REVIEW_OPPORTUNITY_TYPES } from '../tc'; */ function filterByGroupIds(challenge, state) { - if (!state.groupIds) return true; - return state.groupIds.some(id => challenge.groups[id]); + if (_.isEmpty(state.groupIds)) return true; + if (_.isEmpty(challenge.groups)) return false; + return state.groupIds.some(id => challenge.groups.find(gId => gId === id)); } function filterByRegistrationOpen(challenge, state) { @@ -343,7 +344,7 @@ export function combine(...filters) { const res = {}; filters.forEach((filter) => { combineEndDate(res, filter); - combineArrayRules(res, filter, 'groups'); + combineArrayRules(res, filter, 'groupIds'); /* TODO: The registrationOpen rule is just ignored for now. */ combineStartDate(res, filter); combineArrayRules(res, filter, 'or', true); @@ -380,7 +381,7 @@ export function combine(...filters) { */ export function mapToBackend(filter) { const res = {}; - if (filter.groups) res.groups = filter.groups; + if (filter.groupIds) res.groups = filter.groupIds; return res; } From a8862cc1dfb132e8444f2df9f647070d71de1f0f Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 25 Aug 2020 02:02:04 -0300 Subject: [PATCH 05/14] Added filterByEvents to TCO filter --- src/utils/challenge/filter.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 31c28c5c..e37974c4 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -151,6 +151,12 @@ function filterByTags(challenge, state) { return state.tags.some(tag => str.includes(tag.toLowerCase())); } +function filterByEvents(challenge, state) { + if (_.isEmpty(state.events)) return true; + if (_.isEmpty(challenge.events)) return false; + return state.events.some(key => challenge.events.find(e => e.key === key )); +} + function filterByText(challenge, state) { if (!state.text) return true; const str = `${challenge.name} ${challenge.tags} ${challenge.platforms} ${challenge.tags}` @@ -215,6 +221,7 @@ export function getFilterFunction(state) { && filterByGroupIds(challenge, state) && filterByText(challenge, state) && filterByTags(challenge, state) + && filterByEvents(challenge, state) && filterByTypes(challenge, state) && filterByUsers(challenge, state) && filterByEndDate(challenge, state) From 0b002e812d1af3b42b1d0dd66cb80052b6c8bca1 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 25 Aug 2020 02:19:17 -0300 Subject: [PATCH 06/14] Fix filterByTags check if isEmpty --- src/utils/challenge/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index e37974c4..331daf99 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -145,7 +145,7 @@ function filterByStatus(challenge, state) { } function filterByTags(challenge, state) { - if (!state.tags) return true; + if (_.isEmpty(state.tags)) return true; const { platforms, tags } = challenge; const str = `${platforms} ${tags}`.toLowerCase(); return state.tags.some(tag => str.includes(tag.toLowerCase())); From 4bc24f2e18da6ed90ba49d044d9a3d212fdb9afa Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 25 Aug 2020 03:04:02 -0300 Subject: [PATCH 07/14] Fix test --- src/utils/challenge/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 331daf99..117e0609 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -154,7 +154,7 @@ function filterByTags(challenge, state) { function filterByEvents(challenge, state) { if (_.isEmpty(state.events)) return true; if (_.isEmpty(challenge.events)) return false; - return state.events.some(key => challenge.events.find(e => e.key === key )); + return state.events.some(key => challenge.events.find(e => e.key === key)); } function filterByText(challenge, state) { From 477ccfebf66abec94167af297b44f1c6a9905d06 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 25 Aug 2020 05:03:04 -0300 Subject: [PATCH 08/14] Remove hard code tracks and subtracks --- __tests__/__snapshots__/index.js.snap | 10 ++++++++++ src/services/reviewOpportunities.js | 20 +++++++++++--------- src/utils/tc.js | 12 ++++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 53d2317a..bf72ddb8 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -377,6 +377,16 @@ Object { "DEVELOP": "Development", "QA": "Quality Assurance", }, + "OLD_COMPETITION_TRACKS": Object { + "DATA_SCIENCE": "DATA_SCIENCE", + "DESIGN": "DESIGN", + "DEVELOP": "DEVELOP", + "QA": "QA", + }, + "OLD_SUBTRACKS": Object { + "BUG_HUNT": "BUG_HUNT", + "TEST_SUITES": "TEST_SUITES", + }, "REVIEW_OPPORTUNITY_TYPES": Object { "Contest Review": "Review", "Iterative Review": "Iterative Review", diff --git a/src/services/reviewOpportunities.js b/src/services/reviewOpportunities.js index 820f5a46..87f8dcd3 100644 --- a/src/services/reviewOpportunities.js +++ b/src/services/reviewOpportunities.js @@ -4,6 +4,7 @@ * submitting applications. */ import _ from 'lodash'; +import { COMPETITION_TRACKS, OLD_COMPETITION_TRACKS, OLD_SUBTRACKS } from 'utils/tc'; import { getApi } from './api'; /** @@ -16,17 +17,18 @@ export function normalizeChallenges(opportunities) { * until receive API V5 update. */ _.map(opportunities, (opportunity) => { const { challenge } = opportunity; - challenge.track = 'Development'; + challenge.track = COMPETITION_TRACKS.DEVELOP; if (challenge.technologies) { - if (challenge.technologies.includes('Data Science')) { - challenge.track = 'Data Science'; - } else if (challenge.technologies.includes('QA')) { - challenge.track = 'Quality Assurance'; + if (challenge.technologies.includes(COMPETITION_TRACKS.DATA_SCIENCE)) { + challenge.track = COMPETITION_TRACKS.DATA_SCIENCE; + } else if (challenge.technologies.includes(OLD_COMPETITION_TRACKS.QA)) { + challenge.track = COMPETITION_TRACKS.QA; } - } else if (challenge.subTrack === 'TEST_SUITES' || challenge.subTrack === 'BUG_HUNT') { - challenge.track = 'Quality Assurance'; - } else if (challenge.track === 'DESIGN') { - challenge.track = 'Design'; + } else if (challenge.subTrack === OLD_SUBTRACKS.TEST_SUITES + || challenge.subTrack === OLD_SUBTRACKS.BUG_HUNT) { + challenge.track = COMPETITION_TRACKS.QA; + } else if (challenge.track === OLD_COMPETITION_TRACKS.DESIGN) { + challenge.track = COMPETITION_TRACKS.DESIGN; } return _.defaults(opportunity, { challenge }); }); diff --git a/src/utils/tc.js b/src/utils/tc.js index 5388d4bb..28bcf3b2 100644 --- a/src/utils/tc.js +++ b/src/utils/tc.js @@ -17,6 +17,18 @@ export const COMPETITION_TRACKS = { QA: 'Quality Assurance', }; +export const OLD_COMPETITION_TRACKS = { + DATA_SCIENCE: 'DATA_SCIENCE', + DESIGN: 'DESIGN', + DEVELOP: 'DEVELOP', + QA: 'QA', +}; + +export const OLD_SUBTRACKS = { + TEST_SUITES: 'TEST_SUITES', + BUG_HUNT: 'BUG_HUNT', +}; + /** * Review Opportunity types */ From c34961cf758b63c1d0cd87b00634a05262a534c7 Mon Sep 17 00:00:00 2001 From: Cagdas U Date: Sun, 23 Aug 2020 23:26:13 +0300 Subject: [PATCH 09/14] fix(challenge-utils): update `filterByUsers` to use `userId` Update `filterByUsers` function to use `challenge.users[userId]` property instead of `userChallenges` for filtering. Addresses topcoder-platform/community-app#4782 --- src/utils/challenge/filter.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 263c3132..d662a230 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -173,8 +173,11 @@ function filterByUpcoming(challenge, state) { } function filterByUsers(challenge, state) { - if (!state.userChallenges) return true; - return state.userChallenges.find(ch => challenge.id === ch); + const userId = _.get(state, 'userId', null); + if (userId) { + return _.get(challenge, ['users', userId], false); + } + return true; } /** From 394020b2312fe98facb7c51cf3a3de18c3156845 Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Tue, 25 Aug 2020 14:10:03 +0530 Subject: [PATCH 10/14] fix: for #4782 https://github.com/topcoder-platform/community-app/issues/4782 cagdas001 https://github.com/topcoder-platform/community-app/pull/4801 https://github.com/topcoder-platform/topcoder-react-lib/pull/228 1000.20.0 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0e161844..e8eac28e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,7 +28,7 @@ jobs: - attach_workspace: at: . - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - - run: npm publish + - run: npm publish --tag test-release # dont change anything workflows: version: 2 From 4b5f5f3a0d89cc3bb6130e5c7d6e8899ce5f8c93 Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Tue, 25 Aug 2020 14:11:45 +0530 Subject: [PATCH 11/14] fix: for #4782 https://github.com/topcoder-platform/community-app/issues/4782 cagdas001 https://github.com/topcoder-platform/community-app/pull/4801 https://github.com/topcoder-platform/topcoder-react-lib/pull/228 1000.20.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9654cb9..f5e94194 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": "1.0.0", + "version": "1000.20.0", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 5367d032435fecc62944a5ec50b7f2cc38fa6477 Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Thu, 27 Aug 2020 16:12:11 +0530 Subject: [PATCH 12/14] fix: for #4739 https://github.com/topcoder-platform/community-app/issues/4739 luiz https://github.com/topcoder-platform/community-app/pull/4742 https://github.com/topcoder-platform/topcoder-react-lib/pull/219 1000.20.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5e94194..857382d3 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.20.0", + "version": "1000.20.1", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 8fe8d9e170072b50e1bb47e98b0a7c8ed520b5bc Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Thu, 27 Aug 2020 16:15:45 +0530 Subject: [PATCH 13/14] fix: for #4739 https://github.com/topcoder-platform/community-app/issues/4739 luiz https://github.com/topcoder-platform/community-app/pull/4742 https://github.com/topcoder-platform/topcoder-react-lib/pull/219 1000.20.1 --- src/services/challenges.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index fd0fecec..5f497304 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -328,7 +328,7 @@ class ChallengesService { if (/^[\d]{5,8}$/.test(challengeId)) { isLegacyChallenge = true; challenge = await this.private.getChallenges('/challenges/', { legacyId: challengeId }) - .then(res => res.challenges[0]); + .then(res => res.challenges); } else { challenge = await this.private.getChallenges(`/challenges/${challengeId}`) .then(res => res.challenges); From c7656cf71d657b0fce174fb521a2e90ddf0d2d86 Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Thu, 27 Aug 2020 17:44:20 +0530 Subject: [PATCH 14/14] fix: for #4575 https://github.com/topcoder-platform/community-app/issues/4575 luiz https://github.com/topcoder-platform/community-app/pull/4810 https://github.com/topcoder-platform/topcoder-react-lib/pull/231 1000.20.2 1000.20.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 857382d3..8086c298 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.20.1", + "version": "1000.20.3", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0",