Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: topcoder-platform/topcoder-react-lib
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.2.10
Choose a base ref
...
head repository: topcoder-platform/topcoder-react-lib
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Nov 30, 2022

  1. Copy the full SHA
    f52482f View commit details
  2. Merge pull request #355 from bountyC0d3r/plat-1703-tg-submit-url-issue

    removed caching while getting groups
    rakibansary authored Nov 30, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fa3e79f View commit details

Commits on Feb 17, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2c779de View commit details
  2. Merge pull request #359 from topcoder-platform/revert-355-plat-1703-t…

    …g-submit-url-issue
    
    Revert "removed caching while getting groups"
    luizrrodrigues authored Feb 17, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fd71be9 View commit details

Commits on Mar 3, 2023

  1. changes for the oldId

    bountyC0d3r committed Mar 3, 2023
    Copy the full SHA
    9730888 View commit details

Commits on Mar 6, 2023

  1. Merge pull request #361 from bountyC0d3r/develop

    changes for the oldId
    luizrrodrigues authored Mar 6, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    38a21db View commit details
  2. update for the group seq

    bountyC0d3r committed Mar 6, 2023
    Copy the full SHA
    492fea1 View commit details
  3. Merge pull request #363 from bountyC0d3r/develop

    update for the group seq
    luizrrodrigues authored Mar 6, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    469aedd View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8c9fc49 View commit details

Commits on Mar 8, 2023

  1. Merge pull request #362 from topcoder-platform/PROD-4120

    update topcoder-react-lib and community-app for topgear submit URL issue
    luizrrodrigues authored Mar 8, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    83b35ed View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5e6a4d3 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    90807dd View commit details
  4. bump version

    luizrrodrigues authored Mar 8, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c683008 View commit details
  5. Merge pull request #365 from topcoder-platform/develop

    Release v1.2.11 - Fix: Topgear `submit` URL issue
    luizrrodrigues authored Mar 8, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    022f63b View commit details

Commits on May 16, 2023

  1. Copy the full SHA
    7dbdb11 View commit details

Commits on May 18, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3ebdf03 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    181a6d5 View commit details

Commits on May 19, 2023

  1. Copy the full SHA
    cc27f04 View commit details
  2. Merge pull request #368 from topcoder-platform/PROD-4262

    Fix version in package.json for publishing to npm
    jmgasper authored May 19, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5d008e5 View commit details
  3. Merge pull request #369 from topcoder-platform/develop

    Fix package.json for v1.2.12
    jmgasper authored May 19, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5e4844a View commit details

Commits on Oct 23, 2023

  1. Copy the full SHA
    265f4e6 View commit details
  2. linter

    vas3a committed Oct 23, 2023
    Copy the full SHA
    f625ea2 View commit details
  3. linter

    vas3a committed Oct 23, 2023
    Copy the full SHA
    a894ee4 View commit details
  4. Merge pull request #370 from topcoder-platform/TSJR-27_skills-depreca…

    …tion
    
    TSJR-27 - add deprecation warning for the old api skills
    vas3a authored Oct 23, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    81e04d2 View commit details
  5. Copy the full SHA
    16b7345 View commit details
  6. Versioning

    jmgasper committed Oct 23, 2023
    Copy the full SHA
    8d0898a View commit details
  7. Lint fixes

    jmgasper committed Oct 23, 2023
    Copy the full SHA
    f77ea84 View commit details
  8. Merge pull request #371 from topcoder-platform/develop

    Version 1.2.13
    jmgasper authored Oct 23, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    de5142d View commit details

Commits on Jan 11, 2024

  1. Copy the full SHA
    84f8918 View commit details
  2. Versioning

    jmgasper committed Jan 11, 2024
    Copy the full SHA
    0dbab0c View commit details
  3. Merge pull request #372 from topcoder-platform/develop

    Update to use v5 challenge API instead of v2
    jmgasper authored Jan 11, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3779da9 View commit details

Commits on Mar 7, 2024

  1. fix: temporarily suppress checkpoint winner results

    Signed-off-by: Rakib Ansary <rakibansary@gmail.com>
    rakibansary committed Mar 7, 2024
    Copy the full SHA
    d5b2706 View commit details
  2. fix: lint

    Signed-off-by: Rakib Ansary <rakibansary@gmail.com>
    rakibansary committed Mar 7, 2024
    Copy the full SHA
    7d236df View commit details
  3. Copy the full SHA
    66e61bd View commit details
  4. fix: test

    Signed-off-by: Rakib Ansary <rakibansary@Rakibs-MacBook-Pro.local>
    rakibansary committed Mar 7, 2024
    Copy the full SHA
    29ec338 View commit details
  5. Merge pull request #373 from topcoder-platform/PS-185

    fix: temporarily suppress checkpoint winner results
    rakibansary authored Mar 7, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d9a379e View commit details
  6. Merge pull request #374 from topcoder-platform/develop

    fix: disable checkpoints winners
    rakibansary authored Mar 7, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    052b52e View commit details
Showing with 4,847 additions and 4,214 deletions.
  1. +1 −1 .circleci/config.yml
  2. +2 −1 config/default.json
  3. +4 −7 docs/actions.challenge.md
  4. +4,768 −4,139 package-lock.json
  5. +1 −1 package.json
  6. +37 −38 src/actions/challenge.js
  7. +1 −1 src/reducers/challenge.js
  8. +18 −7 src/services/challenges.js
  9. +10 −19 src/services/groups.js
  10. +5 −0 src/services/members.js
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -15,8 +15,8 @@ jobs:
key: node-modules-{{ checksum "package-lock.json" }}
paths:
- node_modules
- run: npm test
- run: npm run build
- run: npm test
- persist_to_workspace:
root: .
paths:
3 changes: 2 additions & 1 deletion config/default.json
Original file line number Diff line number Diff line change
@@ -2,5 +2,6 @@
"AV_SCAN_SCORER_REVIEW_TYPE_ID": "",
"PROVISIONAL_SCORING_COMPLETED_REVIEW_TYPE_ID": "",
"PAGE_SIZE": 50,
"REVIEW_OPPORTUNITY_PAGE_SIZE": 1000
"REVIEW_OPPORTUNITY_PAGE_SIZE": 1000,
"CHALLENGE_APP_VERSION": "1.1.0"
}
11 changes: 4 additions & 7 deletions docs/actions.challenge.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ Actions related to Topcoder challenges APIs.
* [.unregisterInit()](#module_actions.challenge.unregisterInit) ⇒ <code>Action</code>
* [.unregisterDone(auth, challengeId)](#module_actions.challenge.unregisterDone) ⇒ <code>Action</code>
* [.loadResultsInit(challengeId)](#module_actions.challenge.loadResultsInit) ⇒ <code>Action</code>
* [.loadResultsDone(auth, challengeId, type)](#module_actions.challenge.loadResultsDone) ⇒ <code>Action</code>
* [.loadResultsDone(challengeId, tokenV3)](#module_actions.challenge.loadResultsDone) ⇒ <code>Action</code>
* [.fetchCheckpointsInit()](#module_actions.challenge.fetchCheckpointsInit) ⇒ <code>Action</code>
* [.fetchCheckpointsDone(tokenV2, challengeId)](#module_actions.challenge.fetchCheckpointsDone)
* [.toggleCheckpointFeedback(id, open)](#module_actions.challenge.toggleCheckpointFeedback) ⇒ <code>Action</code>
@@ -144,18 +144,15 @@ Creates an action that signals beginning of challenge results loading.

<a name="module_actions.challenge.loadResultsDone"></a>

### actions.challenge.loadResultsDone(auth, challengeId, type) ⇒ <code>Action</code>
### actions.challenge.loadResultsDone(challengeId, tokenV3) ⇒ <code>Action</code>
Creates an action that loads challenge results.

**Kind**: static method of [<code>actions.challenge</code>](#module_actions.challenge)
**Kind**: static method of [<code>actions.challenge</code>](#module_actions.challenge)

| Param | Type | Description |
| --- | --- | --- |
| auth | <code>Object</code> | Object that holds Topcoder auth tokens. |
| [auth.tokenV2] | <code>String</code> | v2 token. |
| [auth.tokenV3] | <code>String</code> | v3 token. |
| challengeId | <code>Number</code> \| <code>String</code> | Challenge ID. Should match the one passed in the previous [loadResultsInit](#module_actions.challenge.loadResultsInit) call. |
| type | <code>String</code> | Challenge type. |
| tokenV3 | <code>String</code> | Topcoder v3 auth token. |

<a name="module_actions.challenge.fetchCheckpointsInit"></a>

8,907 changes: 4,768 additions & 4,139 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
"test": "npm run lint && npm run jest"
},
"version": "1.2.10",
"version": "1.2.14",
"dependencies": {
"auth0-js": "^6.8.4",
"config": "^3.2.0",
75 changes: 37 additions & 38 deletions src/actions/challenge.js
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import { createActions } from 'redux-actions';
import { decodeToken } from '@topcoder-platform/tc-auth-lib';
import { getService as getChallengesService } from '../services/challenges';
import { getService as getSubmissionService } from '../services/submissions';
import { getApi } from '../services/api';
// import { getApi } from '../services/api';
import * as submissionUtil from '../utils/submission';

const { PAGE_SIZE } = CONFIG;
@@ -239,22 +239,16 @@ function loadResultsInit(challengeId) {
/**
* @static
* @desc Creates an action that loads challenge results.
* @param {Object} auth Object that holds Topcoder auth tokens.
* @param {String} [auth.tokenV2] v2 token.
* @param {String} [auth.tokenV3] v3 token.
* @param {Number|String} challengeId Challenge ID. Should match the one passed
* in the previous {@link module:actions.challenge.loadResultsInit} call.
* @param {String} type Challenge type.
* @param {String} challengeId The challenge id
* @param {String} tokenV3 Topcoder auth token v3.
* @return {Action}
*/
function loadResultsDone(auth, challengeId, type) {
return getApi('V2')
.fetch(`/${type}/challenges/result/${challengeId}`)
.then(response => response.json())
.then(response => ({
challengeId: _.toString(challengeId),
results: response.results,
}));
function loadResultsDone(challengeId, tokenV3) {
const service = getChallengesService(tokenV3);
return service.getChallengeDetails(challengeId).then(response => ({
challengeId,
results: response.winners,
}));
}

/**
@@ -272,29 +266,34 @@ function fetchCheckpointsInit() {}
* @param {String} challengeId Challenge ID.
*/
function fetchCheckpointsDone(tokenV2, challengeId) {
const endpoint = `/design/challenges/checkpoint/${challengeId}`;
return getApi('V2').fetch(endpoint)
.then((response) => {
if (response.status !== 200) {
throw response.status;
} else {
return response.json();
}
})
.then((response) => {
// Expanded key is used for UI expand/collapse.
response.checkpointResults.forEach((checkpoint, index) => {
response.checkpointResults[index].expanded = false;
});
return {
challengeId: String(challengeId),
checkpoints: response,
};
})
.catch(error => ({
error,
challengeId: String(challengeId),
}));
// const endpoint = `/design/challenges/checkpoint/${challengeId}`;
// return getApi('V2').fetch(endpoint)
// .then((response) => {
// if (response.status !== 200) {
// throw response.status;
// } else {
// return response.json();
// }
// })
// .then((response) => {
// // Expanded key is used for UI expand/collapse.
// response.checkpointResults.forEach((checkpoint, index) => {
// response.checkpointResults[index].expanded = false;
// });
// return {
// challengeId: String(challengeId),
// checkpoints: response,
// };
// })
// .catch(error => ({
// error,
// challengeId: String(challengeId),
// }));

return {
challengeId: String(challengeId),
checkpoints: [],
};
}

/**
2 changes: 1 addition & 1 deletion src/reducers/challenge.js
Original file line number Diff line number Diff line change
@@ -520,7 +520,7 @@ export function factory(options = {}) {
}
const resultsPromise = challengeDetails.status === 'Completed' ? (
redux.resolveAction(
actions.challenge.loadResultsDone(tokens, challengeId, track.toLowerCase()),
actions.challenge.loadResultsDone(challengeId, tokens.tokenV3),
)
) : null;
return Promise.all([res, checkpointsPromise, resultsPromise]);
25 changes: 18 additions & 7 deletions src/services/challenges.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
* Topcoder challenges via TC API.
*/

/* global CONFIG */
import _ from 'lodash';
import moment from 'moment';
import qs from 'qs';
@@ -15,6 +16,8 @@ import { getApi } from './api';
import { getService as getMembersService } from './members';
import { getService as getSubmissionsService } from './submissions';

const { CHALLENGE_APP_VERSION } = CONFIG;

export function getFilterUrl(backendFilter, frontFilter) {
const ff = _.clone(frontFilter);
// eslint-disable-next-line object-curly-newline
@@ -178,7 +181,8 @@ class ChallengesService {
&& !_.isEqual(filter.frontFilter.types, [])) {
const query = getFilterUrl(filter.backendFilter, filter.frontFilter);
const url = `${endpoint}?${query}`;
res = await this.private.apiV5.get(url).then(checkErrorV5);
const options = { headers: { 'app-version': CHALLENGE_APP_VERSION } };
res = await this.private.apiV5.get(url, options).then(checkErrorV5);
}
return {
challenges: res.result || [],
@@ -203,7 +207,8 @@ class ChallengesService {
query = `legacyId=${legacyInfo.legacyId}`;
}
const url = `${endpoint}?${query}`;
const res = await this.private.apiV5.get(url).then(checkErrorV5);
const options = { headers: { 'app-version': CHALLENGE_APP_VERSION } };
const res = await this.private.apiV5.get(url, options).then(checkErrorV5);
return {
challenges: res.result || [],
};
@@ -230,7 +235,8 @@ class ChallengesService {
memberId,
};
const url = `${endpoint}?${qs.stringify(_.omit(query, ['limit', 'offset', 'technologies']))}`;
const res = await this.private.apiV5.get(url).then(checkError);
const options = { headers: { 'app-version': CHALLENGE_APP_VERSION } };
const res = await this.private.apiV5.get(url, options).then(checkError);
const totalCount = res.length;
return {
challenges: res || [],
@@ -471,6 +477,7 @@ class ChallengesService {
const roleId = this.private.tokenV3 ? await this.getRoleId('Submitter') : null;
let params = {
challengeId,
perPage: 5000,
};

if (roleId) {
@@ -564,7 +571,8 @@ class ChallengesService {
if (_.some(filter.frontFilter.tracks, val => val)
&& !_.isEqual(filter.frontFilter.types, [])) {
const url = `/recommender-api/${handle}?${query}`;
res = await this.private.apiV5.get(url).then(checkErrorV5);
const options = { headers: { 'app-version': CHALLENGE_APP_VERSION } };
res = await this.private.apiV5.get(url, options).then(checkErrorV5);
totalCount = res.headers.get('x-total') || 0;
}

@@ -617,7 +625,8 @@ class ChallengesService {
memberId: userId,
};
const url = `/challenges?${qs.stringify(_.omit(query, ['limit', 'offset', 'technologies']))}`;
const userChallenges = await this.private.apiV5.get(url)
const options = { headers: { 'app-version': CHALLENGE_APP_VERSION } };
const userChallenges = await this.private.apiV5.get(url, options)
.then(checkErrorV5)
.then((res) => {
res.result.forEach(item => normalizeChallenge(item, userId));
@@ -676,7 +685,8 @@ class ChallengesService {
memberId,
};

const res = await this.private.apiV5.get(`/challenges?${qs.stringify(newParams)}`);
const options = { headers: { 'app-version': CHALLENGE_APP_VERSION } };
const res = await this.private.apiV5.get(`/challenges?${qs.stringify(newParams)}`, options);
return res.json();
}

@@ -688,7 +698,8 @@ class ChallengesService {
*/
async getUserSrms(handle, params) {
const url = `/members/${handle}/srms/?${qs.stringify(params)}`;
const res = await this.private.api.get(url);
const options = { headers: { 'app-version': CHALLENGE_APP_VERSION } };
const res = await this.private.api.get(url, options);
return getApiResponsePayload(res);
}

29 changes: 10 additions & 19 deletions src/services/groups.js
Original file line number Diff line number Diff line change
@@ -319,28 +319,19 @@ class GroupService {
* cache. Defaults to 5 minutes.
* @return {Promise} Resolves to ID array.
*/
async getGroupTreeIds(rootGroupId, maxage = 5 * 60 * 1000) {
const now = Date.now();
const cache = this.private.cache.groupTreeIds;
async getGroupTreeIds(rootGroupId) {
const rootGroupURL = `/groups/${rootGroupId}`;
const rootGroupRes = await this.private.api.get(rootGroupURL);
const rootGroupJSON = await handleApiResponse(rootGroupRes);

/* Clean-up: removes stale records from the cache. */
const CLEAN_UP_INTERVAL = 24 * 60 * 60 * 1000; // 1 day in ms.
if (now - cache.lastCleanUp > CLEAN_UP_INTERVAL) {
_.forOwn(cache, ({ timestamp }, key) => {
if (now - timestamp > CLEAN_UP_INTERVAL) delete cache[key];
});
cache.lastCleanUp = now;
}
const url = `/groups/${rootGroupJSON.id}?flattenGroupIdTree=true`;
const response = await this.private.api.get(url);
const responseJSON = await handleApiResponse(response);

/* If result is found in cache, and is fresh enough, return it. */
const cached = cache[rootGroupId];
if (cached && now - cached.timestamp < maxage) return _.clone(cached.data);
const treeIds = responseJSON.flattenGroupIdTree;
treeIds.unshift(responseJSON.id);

/* Otherwise, fetch result from the API, write it to the cache, and
* finally return that. */
const res = reduceGroupIds(await this.getGroup(rootGroupId));
cache[rootGroupId] = { data: res, timestamp: now };
return _.clone(res);
return treeIds;
}

/**
5 changes: 5 additions & 0 deletions src/services/members.js
Original file line number Diff line number Diff line change
@@ -70,6 +70,11 @@ class MembersService {
}

/**
* @deprecated This method is using the old API skills,
* and the returned skills may not be what you're looking for
* @todo Replace this method and use the new standardized skills when needed
* @see https://topcoder.atlassian.net/browse/TSJR-27
*
* Gets member skills.
* @param {String} handle
* @return {Promise} Resolves to the stats object.