Skip to content

Commit ec7e414

Browse files
Updated params groupIds to groups
1 parent b7da5e1 commit ec7e414

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/services/__mocks__/challenges.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ export function normalizeChallengeDetails(v3, v3Filtered, v3User, v2, username)
8585
// Fill missing data from v3_filtered
8686
if (v3Filtered) {
8787
const groups = {};
88-
if (v3Filtered.groupIds) {
89-
v3Filtered.groupIds.forEach((id) => {
88+
if (v3Filtered.groups) {
89+
v3Filtered.groups.forEach((id) => {
9090
groups[id] = true;
9191
});
9292
}
@@ -165,8 +165,8 @@ export function normalizeChallengeDetails(v3, v3Filtered, v3User, v2, username)
165165
export function normalizeChallenge(challenge, username) {
166166
const registrationOpen = challenge.allPhases.filter(d => d.name === 'Registration')[0].isOpen ? 'Yes' : 'No';
167167
const groups = {};
168-
if (challenge.groupIds) {
169-
challenge.groupIds.forEach((id) => {
168+
if (challenge.groups) {
169+
challenge.groups.forEach((id) => {
170170
groups[id] = true;
171171
});
172172
}

src/utils/challenge/filter.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* endDate {Number|String} - Permits only those challenges with submission
1919
* deadline before this date.
2020
*
21-
* groupIds {Array} - Permits only the challenges belonging to at least one
21+
* groups {Array} - Permits only the challenges belonging to at least one
2222
* of the groups which IDs are presented as keys in this object.
2323
*
2424
* or {Object[]} - All other filter fields applied to the challenge with AND
@@ -71,8 +71,8 @@ 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 (!state.groups) return true;
75+
return state.groups.some(id => challenge.groups[id]);
7676
}
7777

7878
function filterByRegistrationOpen(challenge, state) {
@@ -343,7 +343,7 @@ export function combine(...filters) {
343343
const res = {};
344344
filters.forEach((filter) => {
345345
combineEndDate(res, filter);
346-
combineArrayRules(res, filter, 'groupIds');
346+
combineArrayRules(res, filter, 'groups');
347347
/* TODO: The registrationOpen rule is just ignored for now. */
348348
combineStartDate(res, filter);
349349
combineArrayRules(res, filter, 'or', true);
@@ -382,7 +382,7 @@ export function mapToBackend(filter) {
382382
if (filter.or) return {};
383383

384384
const res = {};
385-
if (filter.groupIds) res.groups = filter.groupIds;
385+
if (filter.groups) res.groups = filter.groups;
386386

387387
/* NOTE: Right now the frontend challenge filter by tag works different,
388388
* it looks for matches in the challenge name OR in the techs / platforms. */

0 commit comments

Comments
 (0)