Skip to content

Commit 7b9edf1

Browse files
authored
fix challengeId and projectId filtering in review table (#2712)
* fix challengeId and projectId filtering in review table * run formatting
1 parent 9458dab commit 7b9edf1

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/components/HOCs/WithReviewTasks/WithReviewTasks.jsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,20 @@ export const WithReviewTasks = function (WrappedComponent) {
249249

250250
const criteria =
251251
this.state.criteria[this.props.reviewTasksType] || this.buildDefaultCriteria(this.props);
252-
const projectId = this.state.criteria[this.props.reviewTasksType]?.filters?.projectId;
252+
const projectIdFilter = this.state.criteria[this.props.reviewTasksType]?.filters?.projectId;
253253

254-
// Filter available challenges to ones in selected project if applicable
255-
const reviewChallenges = !projectId
254+
// Filter available challenges to ones in selected project(s) if applicable
255+
const selectedProjectIds = Array.isArray(projectIdFilter)
256+
? projectIdFilter
257+
: projectIdFilter
258+
? [projectIdFilter]
259+
: [];
260+
261+
const reviewChallenges = !selectedProjectIds.length
256262
? this.props.currentReviewTasks.reviewChallenges
257-
: _filter(this.props.currentReviewTasks.reviewChallenges, (c) => c.parent === projectId);
263+
: _filter(this.props.currentReviewTasks.reviewChallenges, (challenge) =>
264+
selectedProjectIds.includes(challenge.parent),
265+
);
258266

259267
return (
260268
<WrappedComponent

0 commit comments

Comments
 (0)