@@ -106,8 +106,8 @@ function filterByRegistrationOpen(challenge, state) {
106
106
* @return {Boolean } True if opp satifies the filter
107
107
*/
108
108
function filterByReviewOpportunityType ( opp , state ) {
109
- if ( ! state . reviewOpportunityType ) return true ;
110
- return opp . type === state . reviewOpportunityType ;
109
+ if ( state . reviewOpportunityTypes . length === 0 ) return false ;
110
+ return state . reviewOpportunityTypes . includes ( opp . type ) ;
111
111
}
112
112
113
113
function filterByStartDate ( challenge , state ) {
@@ -158,10 +158,10 @@ function filterByEvents(challenge, state) {
158
158
}
159
159
160
160
function filterByText ( challenge , state ) {
161
- if ( ! state . name ) return true ;
161
+ if ( ! state . search ) return true ;
162
162
const str = `${ challenge . name } ${ challenge . tags } ${ challenge . platforms } ${ challenge . tags } `
163
163
. toLowerCase ( ) ;
164
- return str . includes ( state . name . toLowerCase ( ) ) ;
164
+ return str . includes ( state . search . toLowerCase ( ) ) ;
165
165
}
166
166
167
167
function filterByTrack ( challenge , state ) {
@@ -447,14 +447,16 @@ export function setEndDate(state, date) {
447
447
/**
448
448
* Clones the state and sets the review opportunity type.
449
449
* @param {Object } state
450
- * @param {Array } reviewOpportunityType Possible values found in utils/tc REVIEW_OPPORTUNITY_TYPES
450
+ * @param {Array } reviewOpportunityTypes Possible values found in utils/tc REVIEW_OPPORTUNITY_TYPES
451
451
* @return {Object }
452
452
*/
453
- export function setReviewOpportunityType ( state , reviewOpportunityType ) {
454
- if ( reviewOpportunityType ) return { ...state , reviewOpportunityType } ;
455
- if ( ! state . reviewOpportunityType ) return state ;
453
+ export function setReviewOpportunityType ( state , reviewOpportunityTypes ) {
454
+ if ( reviewOpportunityTypes && reviewOpportunityTypes . length ) {
455
+ return { ...state , reviewOpportunityTypes } ;
456
+ }
457
+ if ( ! state . reviewOpportunityTypes ) return state ;
456
458
const res = _ . clone ( state ) ;
457
- delete res . reviewOpportunityType ;
459
+ delete res . reviewOpportunityTypes ;
458
460
return res ;
459
461
}
460
462
0 commit comments