Skip to content

Commit 7b228a7

Browse files
committed
fix: for issue #2069.
1 parent 99efa44 commit 7b228a7

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

Diff for: src/actions/members.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -331,27 +331,29 @@ async function getUserMarathonInit(handle, uuid) {
331331
* @desc Create an action that loads the member marathon.
332332
* @param {String} uuid Operation UUID.
333333
* @param {String} handle Member handle.
334+
* @param {String} memberId Member id.
334335
* @param {String} tokenV3 v3 auth token.
335336
* @param {Number} start page.
336337
* @param {Number} page size.
337338
* @param {Boolean} whether to refresh.
338339
* @return {Action}
339340
*/
340341
async function getUserMarathonDone(
341-
uuid, handle, tokenV3, pageNum, pageSize,
342+
uuid, handle, memberId, tokenV3, pageNum, pageSize,
342343
refresh,
343344
) {
344-
const filter = { status: 'PAST', isRatedForMM: 'true' };
345+
const filter = { status: 'Completed' };
345346
const params = {};
346-
params.orderBy = 'endDate desc';
347-
params.limit = pageSize;
348-
params.offset = pageNum * pageSize;
347+
params.sortBy = 'endDate';
348+
params.sortOrder = 'desc';
349+
params.perPage = pageSize;
350+
params.page = pageNum;
349351

350352
const service = getChallengesService(tokenV3);
351-
return service.getUserMarathonMatches(handle, filter, params)
353+
return service.getUserMarathonMatches(memberId, filter, params)
352354
.then(res => ({
353355
uuid,
354-
marathons: res,
356+
marathons: { challenges: res },
355357
refresh,
356358
handle,
357359
}));

Diff for: src/services/challenges.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -534,18 +534,20 @@ class ChallengesService {
534534
/**
535535
* Gets marathon matches of the specified user.
536536
* @param {String} memberId User whose challenges we want to fetch.
537+
* @param {Object} filter
537538
* @param {Object} params
538539
* @return {Promise} Resolves to the api response.
539540
*/
540-
async getUserMarathonMatches(memberId, params) {
541+
async getUserMarathonMatches(memberId, filter, params) {
541542
const newParams = {
543+
...filter,
542544
...params,
543-
tag: 'Marathon Match',
545+
tags: ['Marathon Match'],
544546
memberId,
545547
};
546548

547549
const res = await this.private.apiV5.get(`/challenges?${qs.stringify(newParams)}`);
548-
return getApiResponsePayload(res);
550+
return res.json();
549551
}
550552

551553
/**

0 commit comments

Comments
 (0)