Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update to use v5 challenge API instead of v2#372

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jmgasper merged 2 commits intomasterfromdevelop
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
11 changes: 4 additions & 7 deletionsdocs/actions.challenge.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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>
Expand DownExpand Up@@ -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>

Expand Down
2 changes: 1 addition & 1 deletionpackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,7 @@
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
"test": "npm run lint && npm run jest"
},
"version": "1.2.13",
"version": "1.2.14",
"dependencies": {
"auth0-js": "^6.8.4",
"config": "^3.2.0",
Expand Down
22 changes: 8 additions & 14 deletionssrc/actions/challenge.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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,
}));
}

/**
Expand Down
2 changes: 1 addition & 1 deletionsrc/reducers/challenge.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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]);
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp