@@ -71,8 +71,9 @@ import { COMPETITION_TRACKS, REVIEW_OPPORTUNITY_TYPES } from '../tc';
71
71
*/
72
72
73
73
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 ) ) ;
76
77
}
77
78
78
79
function filterByRegistrationOpen ( challenge , state ) {
@@ -343,7 +344,7 @@ export function combine(...filters) {
343
344
const res = { } ;
344
345
filters . forEach ( ( filter ) => {
345
346
combineEndDate ( res , filter ) ;
346
- combineArrayRules ( res , filter , 'groups ' ) ;
347
+ combineArrayRules ( res , filter , 'groupIds ' ) ;
347
348
/* TODO: The registrationOpen rule is just ignored for now. */
348
349
combineStartDate ( res , filter ) ;
349
350
combineArrayRules ( res , filter , 'or' , true ) ;
@@ -380,7 +381,7 @@ export function combine(...filters) {
380
381
*/
381
382
export function mapToBackend ( filter ) {
382
383
const res = { } ;
383
- if ( filter . groups ) res . groups = filter . groups ;
384
+ if ( filter . groupIds ) res . groups = filter . groupIds ;
384
385
return res ;
385
386
}
386
387
0 commit comments