Skip to content

Commit 3a69711

Browse files
authored
Merge pull request #4580 from topcoder-platform/issue-4393
Issue#4393 - Challenge Listings: Challenges not loading for subcommunitie
2 parents 586de62 + eaa5c7d commit 3a69711

File tree

3 files changed

+13
-9
lines changed
  • src/shared

3 files changed

+13
-9
lines changed

src/shared/actions/challenge-listing/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,12 @@ function getRestActiveChallengesInit(uuid) {
206206
* @param {String} uuid progress id
207207
* @param {String} tokenV3 token v3
208208
*/
209-
function getRestActiveChallengesDone(uuid, tokenV3) {
210-
const filter = { status: 'Active' };
211-
return getAllActiveChallengesWithUsersDone(uuid, tokenV3, filter, 1);
209+
function getRestActiveChallengesDone(uuid, tokenV3, filter) {
210+
const mergedFilter = {
211+
...filter,
212+
status: 'Active',
213+
};
214+
return getAllActiveChallengesWithUsersDone(uuid, tokenV3, mergedFilter, 1);
212215
}
213216

214217
/**

src/shared/components/challenge-listing/Listing/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ Listing.propTypes = {
216216
setSort: PT.func.isRequired,
217217
sorts: PT.shape().isRequired,
218218
pastSearchTimestamp: PT.number,
219-
userChallenges: PT.arrayOf(PT.shape()),
219+
userChallenges: PT.arrayOf(PT.string),
220220
isLoggedIn: PT.bool.isRequired,
221221
};
222222

src/shared/containers/challenge-listing/Listing/index.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ export class ListingContainer extends React.Component {
103103

104104
if (!loadingActiveChallengesUUID && !_.isEmpty(meta) && !allActiveChallengesLoaded
105105
&& BUCKETS.PAST !== activeBucket) {
106-
getRestActiveChallenges(auth.tokenV3);
106+
const f = this.getBackendFilter();
107+
getRestActiveChallenges(auth.tokenV3, f.back);
107108
}
108109

109110
setTimeout(() => {
@@ -134,8 +135,8 @@ export class ListingContainer extends React.Component {
134135
);
135136
if (communityFilter) communityFilter = communityFilter.challengeFilter;
136137
if (communityFilter) filter = combine(filter, communityFilter);
137-
if (communityId && groupIds.length > 0) {
138-
filter.groupIds = groupIds;
138+
if (communityId && !_.isEmpty(groupIds)) {
139+
filter.groups = groupIds;
139140
}
140141
return {
141142
back: mapToBackend(filter),
@@ -475,10 +476,10 @@ function mapDispatchToProps(dispatch) {
475476
dispatch(a.getActiveChallengesInit(uuid, page, frontFilter));
476477
dispatch(a.getActiveChallengesDone(uuid, page, filter, token, frontFilter));
477478
},
478-
getRestActiveChallenges: (token) => {
479+
getRestActiveChallenges: (token, filter) => {
479480
const uuid = shortId();
480481
dispatch(a.getRestActiveChallengesInit(uuid));
481-
dispatch(a.getRestActiveChallengesDone(uuid, token));
482+
dispatch(a.getRestActiveChallengesDone(uuid, token, filter));
482483
},
483484
getCommunitiesList: (auth) => {
484485
const uuid = shortId();

0 commit comments

Comments
 (0)