@@ -144,22 +144,23 @@ function filterByStatus(challenge, state) {
144
144
}
145
145
146
146
function filterByTags ( challenge , state ) {
147
- if ( ! state . tags ) return true ;
147
+ if ( ! state . tags || state . tags . length === 0 ) return true ;
148
148
const { platforms, tags } = challenge ;
149
- const str = `${ platforms } ${ tags } ` . toLowerCase ( ) ;
149
+ const str = `${ platforms . join ( ' ' ) } ${ tags . join ( ' ' ) } ` . toLowerCase ( ) ;
150
150
return state . tags . some ( tag => str . includes ( tag . toLowerCase ( ) ) ) ;
151
151
}
152
152
153
153
function filterByText ( challenge , state ) {
154
- if ( ! state . text ) return true ;
154
+ if ( ! state . name ) return true ;
155
155
const str = `${ challenge . name } ${ challenge . tags } ${ challenge . platforms } ${ challenge . tags } `
156
156
. toLowerCase ( ) ;
157
- return str . includes ( state . text . toLowerCase ( ) ) ;
157
+ return str . includes ( state . name . toLowerCase ( ) ) ;
158
158
}
159
159
160
160
function filterByTrack ( challenge , state ) {
161
- if ( ! state . tracks ) return true ;
162
- return _ . keys ( state . tracks ) . some ( track => challenge . track === track ) ;
161
+ // if (!state.tracks) return true;
162
+ // eslint-disable-next-line max-len
163
+ return state . tracks [ challenge . track ] === true ;
163
164
}
164
165
165
166
function filterByTypes ( challenge , state ) {
@@ -239,7 +240,13 @@ export function getFilterFunction(state) {
239
240
*/
240
241
export function getReviewOpportunitiesFilterFunction ( state , validTypes ) {
241
242
return ( opp ) => {
242
- const newType = _ . find ( validTypes , { name : opp . challenge . type } ) || { } ;
243
+ const trackAbbr = {
244
+ DATA_SCIENCE : 'DS' ,
245
+ DEVELOP : 'Dev' ,
246
+ DESIGN : 'Des' ,
247
+ QA : 'QA' ,
248
+ } ;
249
+ // const newType = _.find(validTypes, { name: opp.challenge.type }) || {};
243
250
244
251
// Review Opportunity objects have a challenge field which
245
252
// is largely compatible with many of the existing filter functions
@@ -248,16 +255,27 @@ export function getReviewOpportunitiesFilterFunction(state, validTypes) {
248
255
...opp . challenge ,
249
256
// This allows filterByText to search for Review Types and Challenge Titles
250
257
name : `${ opp . challenge . title } ${ REVIEW_OPPORTUNITY_TYPES [ opp . type ] } ` ,
251
- registrationStartDate : opp . startDate , // startDate of Review, not Challenge
252
- submissionEndDate : opp . startDate , // Currently uses startDate for both date comparisons
253
- communities : new Set ( [ // Used to filter by Track, and communities at a future date
254
- opp . challenge . track . toLowerCase ( ) ,
255
- ] ) ,
256
- typeId : newType . id ,
258
+ // registrationStartDate: opp.startDate, // startDate of Review, not Challenge
259
+ // submissionEndDate: opp.startDate, // Currently uses startDate for both date comparisons
260
+ // communities: new Set([ // Used to filter by Track, and communities at a future date
261
+ // opp.challenge.track === 'QA' ? 'Dev' : trackAbbr[opp.challenge.track],
262
+ // ]),
263
+ track : trackAbbr [ opp . challenge . track ] ,
264
+ // typeId: newType.id,
257
265
tags : opp . challenge . technologies || [ ] ,
258
266
platforms : opp . challenge . platforms || [ ] ,
259
267
} ;
260
-
268
+ /**
269
+ console.log(challenge);
270
+ console.log(`=====`);
271
+ console.log(`11111`);
272
+ console.log(filterByTrack(challenge, state));
273
+ console.log(filterByText(challenge, state));
274
+ console.log(filterByTags(challenge, state));
275
+ console.log(filterByEndDate(challenge, state));
276
+ console.log(filterByStartDate(challenge, state));
277
+ console.log(filterByReviewOpportunityType(opp, state));
278
+ */
261
279
return (
262
280
filterByTrack ( challenge , state )
263
281
&& filterByText ( challenge , state )
0 commit comments