@@ -175,9 +175,9 @@ function filterByTrack(challenge, state) {
175
175
return _ . keys ( state . tracks ) . some ( track => challenge . communities . has ( track ) ) ;
176
176
}
177
177
178
- function filterBySubtracks ( challenge , state ) {
179
- if ( ! state . subtracks ) return true ;
180
- return state . subtracks . includes ( challenge . typeId ) ;
178
+ function filterByTypes ( challenge , state ) {
179
+ if ( ! state . types ) return true ;
180
+ return state . types . includes ( challenge . typeId ) ;
181
181
}
182
182
183
183
function filterByUpcoming ( challenge , state ) {
@@ -227,7 +227,7 @@ export function getFilterFunction(state) {
227
227
&& filterByGroupIds ( challenge , state )
228
228
&& filterByText ( challenge , state )
229
229
&& filterByTags ( challenge , state )
230
- && filterBySubtracks ( challenge , state )
230
+ && filterByTypes ( challenge , state )
231
231
&& filterByUsers ( challenge , state )
232
232
&& filterByEndDate ( challenge , state )
233
233
&& filterByStartDate ( challenge , state )
@@ -250,9 +250,9 @@ export function getFilterFunction(state) {
250
250
* @param {Object } state
251
251
* @return {Function }
252
252
*/
253
- export function getReviewOpportunitiesFilterFunction ( state , validSubtracks ) {
253
+ export function getReviewOpportunitiesFilterFunction ( state , validTypes ) {
254
254
return ( opp ) => {
255
- const newSubTrack = _ . find ( validSubtracks , { abbreviation : opp . challenge . subTrack } ) || { } ;
255
+ const newType = _ . find ( validTypes , { name : opp . challenge . type } ) || { } ;
256
256
257
257
// Review Opportunity objects have a challenge field which
258
258
// is largely compatible with many of the existing filter functions
@@ -262,12 +262,11 @@ export function getReviewOpportunitiesFilterFunction(state, validSubtracks) {
262
262
// This allows filterByText to search for Review Types and Challenge Titles
263
263
name : `${ opp . challenge . title } ${ REVIEW_OPPORTUNITY_TYPES [ opp . type ] } ` ,
264
264
registrationStartDate : opp . startDate , // startDate of Review, not Challenge
265
- subTrack : opp . challenge . subTrack || '' , // Sometimes back-end doesn't return this field
266
265
submissionEndDate : opp . startDate , // Currently uses startDate for both date comparisons
267
266
communities : new Set ( [ // Used to filter by Track, and communities at a future date
268
267
opp . challenge . track . toLowerCase ( ) ,
269
268
] ) ,
270
- typeId : newSubTrack . id ,
269
+ typeId : newType . id ,
271
270
tags : opp . challenge . technologies || [ ] ,
272
271
platforms : opp . challenge . platforms || [ ] ,
273
272
} ;
@@ -276,7 +275,7 @@ export function getReviewOpportunitiesFilterFunction(state, validSubtracks) {
276
275
filterByTrack ( challenge , state )
277
276
&& filterByText ( challenge , state )
278
277
&& filterByTags ( challenge , state )
279
- && filterBySubtracks ( challenge , state )
278
+ && filterByTypes ( challenge , state )
280
279
&& filterByEndDate ( challenge , state )
281
280
&& filterByStartDate ( challenge , state )
282
281
&& filterByReviewOpportunityType ( opp , state )
@@ -460,16 +459,16 @@ export function setStartDate(state, date) {
460
459
}
461
460
462
461
/**
463
- * Clones the state and sets the subtracks .
462
+ * Clones the state and sets the challenge types .
464
463
* @param {Object } state
465
- * @param {Array } subtracks
464
+ * @param {Array } types
466
465
* @return {Object }
467
466
*/
468
- export function setSubtracks ( state , subtracks ) {
469
- if ( subtracks && subtracks . length ) return { ...state , subtracks } ;
470
- if ( ! state . subtracks ) return state ;
467
+ export function setTypes ( state , types ) {
468
+ if ( types && types . length ) return { ...state , types } ;
469
+ if ( ! state . types ) return state ;
471
470
const res = _ . clone ( state ) ;
472
- delete res . subtracks ;
471
+ delete res . types ;
473
472
return res ;
474
473
}
475
474
0 commit comments