Skip to content

Commit 65212c6

Browse files
Fix groupIds filter
1 parent f81a302 commit 65212c6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/utils/challenge/filter.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ import { COMPETITION_TRACKS, REVIEW_OPPORTUNITY_TYPES } from '../tc';
7171
*/
7272

7373
function filterByGroupIds(challenge, state) {
74-
if (!state.groupIds) return true;
75-
return state.groupIds.some(id => challenge.groups[id]);
74+
if (_.isEmpty(state.groupIds)) return true;
75+
if (_.isEmpty(challenge.groups)) return false;
76+
return state.groupIds.some(id => challenge.groups.find(gId => gId === id));
7677
}
7778

7879
function filterByRegistrationOpen(challenge, state) {
@@ -343,7 +344,7 @@ export function combine(...filters) {
343344
const res = {};
344345
filters.forEach((filter) => {
345346
combineEndDate(res, filter);
346-
combineArrayRules(res, filter, 'groups');
347+
combineArrayRules(res, filter, 'groupIds');
347348
/* TODO: The registrationOpen rule is just ignored for now. */
348349
combineStartDate(res, filter);
349350
combineArrayRules(res, filter, 'or', true);
@@ -380,7 +381,7 @@ export function combine(...filters) {
380381
*/
381382
export function mapToBackend(filter) {
382383
const res = {};
383-
if (filter.groups) res.groups = filter.groups;
384+
if (filter.groupIds) res.groups = filter.groupIds;
384385
return res;
385386
}
386387

0 commit comments

Comments
 (0)