Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 6 additions & 3 deletions src/shared/actions/challenge-listing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,12 @@ function getRestActiveChallengesInit(uuid) {
* @param {String} uuid progress id
* @param {String} tokenV3 token v3
*/
function getRestActiveChallengesDone(uuid, tokenV3) {
const filter = { status: 'Active' };
return getAllActiveChallengesWithUsersDone(uuid, tokenV3, filter, 1);
function getRestActiveChallengesDone(uuid, tokenV3, filter) {
const mergedFilter = {
...filter,
status: 'Active',
};
return getAllActiveChallengesWithUsersDone(uuid, tokenV3, mergedFilter, 1);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ Listing.propTypes = {
setSort: PT.func.isRequired,
sorts: PT.shape().isRequired,
pastSearchTimestamp: PT.number,
userChallenges: PT.arrayOf(PT.shape()),
userChallenges: PT.arrayOf(PT.string),
isLoggedIn: PT.bool.isRequired,
};

Expand Down
11 changes: 6 additions & 5 deletions src/shared/containers/challenge-listing/Listing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export class ListingContainer extends React.Component {

if (!loadingActiveChallengesUUID && !_.isEmpty(meta) && !allActiveChallengesLoaded
&& BUCKETS.PAST !== activeBucket) {
getRestActiveChallenges(auth.tokenV3);
const f = this.getBackendFilter();
getRestActiveChallenges(auth.tokenV3, f.back);
}

setTimeout(() => {
Expand Down Expand Up @@ -134,8 +135,8 @@ export class ListingContainer extends React.Component {
);
if (communityFilter) communityFilter = communityFilter.challengeFilter;
if (communityFilter) filter = combine(filter, communityFilter);
if (communityId && groupIds.length > 0) {
filter.groupIds = groupIds;
if (communityId && !_.isEmpty(groupIds)) {
filter.groups = groupIds;
}
return {
back: mapToBackend(filter),
Expand Down Expand Up @@ -475,10 +476,10 @@ function mapDispatchToProps(dispatch) {
dispatch(a.getActiveChallengesInit(uuid, page, frontFilter));
dispatch(a.getActiveChallengesDone(uuid, page, filter, token, frontFilter));
},
getRestActiveChallenges: (token) => {
getRestActiveChallenges: (token, filter) => {
const uuid = shortId();
dispatch(a.getRestActiveChallengesInit(uuid));
dispatch(a.getRestActiveChallengesDone(uuid, token));
dispatch(a.getRestActiveChallengesDone(uuid, token, filter));
},
getCommunitiesList: (auth) => {
const uuid = shortId();
Expand Down