Skip to content

Commit e419d06

Browse files
Use v5 challenge API
1 parent 7b7c67d commit e419d06

File tree

7 files changed

+228
-152
lines changed

7 files changed

+228
-152
lines changed

__tests__/__snapshots__/index.js.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ Object {
294294
"default": undefined,
295295
"getService": [Function],
296296
},
297+
"resource": Object {
298+
"default": undefined,
299+
"getService": [Function],
300+
},
297301
"reviewOpportunities": Object {
298302
"default": undefined,
299303
"getReviewOpportunitiesService": [Function],

src/actions/direct.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,15 @@ function getUserProjectsInit(tokenV3) {
7979
* @static
8080
* @desc Creates an action that loads projects related to a user.
8181
* @param {String} tokenV3 Topcoder auth token v3.
82-
* @param {Boolean} hasActiveBillingAccount Optional. Defaults to false.
83-
* Whether only projects with active billing accounts should be included
84-
* into the results.
8582
* @return {Action}
8683
*/
87-
async function getUserProjectsDone(tokenV3, hasActiveBillingAccount) {
88-
const projects = await getService(tokenV3).getUserProjects();
89-
if (hasActiveBillingAccount) {
90-
_.remove(projects, proj => !proj.billingAccountId || proj.billingAccountId === 0);
91-
}
84+
async function getUserProjectsDone(tokenV3) {
85+
// Fetches Member's only Active projects
86+
const projects = await getService(tokenV3).getUserProjects({
87+
memberOnly: true,
88+
sort: 'lastActivityAt desc',
89+
status: 'active',
90+
});
9291
return { tokenV3, projects };
9392
}
9493

src/actions/member-tasks.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ function getDone(uuid, projectId, pageNum, tokenV3) {
6161
return getService(tokenV3).getChallenges({
6262
isTask: true,
6363
projectId,
64-
}, {
65-
limit: PAGE_SIZE,
66-
offset: pageNum * PAGE_SIZE,
64+
sortBy: 'updated',
65+
sortOrder: 'desc',
66+
perPage: PAGE_SIZE,
67+
page: pageNum + 1,
6768
}).then(({ challenges, totalCount }) => ({
6869
projectId,
6970
tasks: challenges,

src/reducers/direct.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function onGetProjectDetailsDone(state, { error, payload }) {
5454
logger.error('Failed to load project details', payload);
5555
throw payload;
5656
}
57-
if (payload.project.projectId !== state.loadingProjectDetailsForId) {
57+
if (payload.id !== state.loadingProjectDetailsForId) {
5858
return state;
5959
}
6060
return {

0 commit comments

Comments
 (0)