Skip to content

Commit 86571d7

Browse files
restore the old filterByType operation
1 parent 4380099 commit 86571d7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/utils/challenge/filter.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function filterByTrack(challenge, state) {
164164
}
165165

166166
function filterByTypes(challenge, state) {
167-
if (!state.types) return true;
167+
if (state.types.length === 0) return true;
168168
return state.types.includes(challenge.typeId);
169169
}
170170

@@ -173,10 +173,10 @@ function filterByUpcoming(challenge, state) {
173173
return moment().isBefore(challenge.registrationStartDate);
174174
}
175175

176-
function filterByUsers(challenge, state) {
177-
if (!state.userChallenges) return true;
178-
return state.userChallenges.find(ch => challenge.id === ch);
179-
}
176+
// function filterByUsers(challenge, state) {
177+
// if (!state.userChallenges) return true;
178+
// return state.userChallenges.find(ch => challenge.id === ch);
179+
// }
180180

181181
/**
182182
* Returns clone of the state with the specified competition track added.
@@ -216,7 +216,7 @@ export function getFilterFunction(state) {
216216
&& filterByText(challenge, state)
217217
&& filterByTags(challenge, state)
218218
&& filterByTypes(challenge, state)
219-
&& filterByUsers(challenge, state)
219+
// && filterByUsers(challenge, state)
220220
&& filterByEndDate(challenge, state)
221221
&& filterByStartDate(challenge, state)
222222
&& filterByStarted(challenge, state)
@@ -238,7 +238,7 @@ export function getFilterFunction(state) {
238238
* @param {Object} state
239239
* @return {Function}
240240
*/
241-
export function getReviewOpportunitiesFilterFunction(state) {
241+
export function getReviewOpportunitiesFilterFunction(state, validTypes) {
242242
return (opp) => {
243243
const trackAbbr = {
244244
DATA_SCIENCE: 'DS',
@@ -247,6 +247,7 @@ export function getReviewOpportunitiesFilterFunction(state) {
247247
QA: 'QA',
248248
};
249249
// const newType = _.find(validTypes, { name: opp.challenge.type }) || {};
250+
const newType = _.find(validTypes, { name: opp.challenge.subTrack === 'FIRST_2_FINISH' ? 'First2Finish' : 'Challenge' }) || {};
250251

251252
// Review Opportunity objects have a challenge field which
252253
// is largely compatible with many of the existing filter functions
@@ -261,7 +262,7 @@ export function getReviewOpportunitiesFilterFunction(state) {
261262
// opp.challenge.track === 'QA' ? 'Dev' : trackAbbr[opp.challenge.track],
262263
// ]),
263264
track: trackAbbr[opp.challenge.track],
264-
// typeId: newType.id,
265+
typeId: newType.abbreviation,
265266
tags: opp.challenge.technologies || [],
266267
platforms: opp.challenge.platforms || [],
267268
};

0 commit comments

Comments
 (0)