Skip to content

Release 2020-09-15 #253

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 15, 2020
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff 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.0.4",
"version": "1.0.5",
"dependencies": {
"auth0-js": "^6.8.4",
"config": "^3.2.0",
Expand Down
16 changes: 9 additions & 7 deletions src/actions/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,27 +331,29 @@ async function getUserMarathonInit(handle, uuid) {
* @desc Create an action that loads the member marathon.
* @param {String} uuid Operation UUID.
* @param {String} handle Member handle.
* @param {String} memberId Member id.
* @param {String} tokenV3 v3 auth token.
* @param {Number} start page.
* @param {Number} page size.
* @param {Boolean} whether to refresh.
* @return {Action}
*/
async function getUserMarathonDone(
uuid, handle, tokenV3, pageNum, pageSize,
uuid, handle, memberId, tokenV3, pageNum, pageSize,
refresh,
) {
const filter = { status: 'PAST', isRatedForMM: 'true' };
const filter = { status: 'Completed' };
const params = {};
params.orderBy = 'endDate desc';
params.limit = pageSize;
params.offset = pageNum * pageSize;
params.sortBy = 'endDate';
params.sortOrder = 'desc';
params.perPage = pageSize;
params.page = pageNum;

const service = getChallengesService(tokenV3);
return service.getUserMarathonMatches(handle, filter, params)
return service.getUserMarathonMatches(memberId, filter, params)
.then(res => ({
uuid,
marathons: res,
marathons: { challenges: res },
refresh,
handle,
}));
Expand Down
6 changes: 4 additions & 2 deletions src/services/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,18 +534,20 @@ class ChallengesService {
/**
* Gets marathon matches of the specified user.
* @param {String} memberId User whose challenges we want to fetch.
* @param {Object} filter
* @param {Object} params
* @return {Promise} Resolves to the api response.
*/
async getUserMarathonMatches(memberId, params) {
async getUserMarathonMatches(memberId, filter, params) {
const newParams = {
...filter,
...params,
tag: 'Marathon Match',
memberId,
};

const res = await this.private.apiV5.get(`/challenges?${qs.stringify(newParams)}`);
return getApiResponsePayload(res);
return res.json();
}

/**
Expand Down