Skip to content

Commit c6a1e34

Browse files
authored
Merge pull request #63 from nauhil/develop
Update filter object for fetch Data Science challenges
2 parents af685a2 + e91a940 commit c6a1e34

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Diff for: src/actions/challenge-listing.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,24 @@ const { PAGE_SIZE, REVIEW_OPPORTUNITY_PAGE_SIZE } = config;
1919

2020
/**
2121
* Process filter
22-
* Development challenges having Data Science tech tag, still should be
23-
* included into data science track.
22+
* When filter includes Data Science track, still should be
23+
* included DEVELOP_MARATHON_MATCH sub track.
2424
* @param filter
2525
* @returns {string}
2626
*/
2727
function processFilter(filter) {
2828
const newFilter = _.clone(filter);
2929
if (_.has(filter, 'track')
3030
&& filter.track.includes(COMPETITION_TRACKS.DATA_SCIENCE.toUpperCase())
31-
&& !filter.track.includes(COMPETITION_TRACKS.DEVELOP.toUpperCase())
31+
&& ((_.has(filter, 'subTrack') && !filter.subTrack.includes('DEVELOP_MARATHON_MATCH'))
32+
|| !_.has(filter, 'subTrack'))
3233
) {
33-
newFilter.track = `${newFilter.track},${COMPETITION_TRACKS.DEVELOP.toUpperCase()}`;
34+
newFilter.subTrack = `${_.has(filter, 'subTrack') ? `${newFilter.subTrack},DEVELOP_MARATHON_MATCH` : 'DEVELOP_MARATHON_MATCH'}`;
35+
newFilter.track = _.remove(filter.track.split(','), item => item.toUpperCase() !== COMPETITION_TRACKS.DATA_SCIENCE.toUpperCase()).join(',');
36+
37+
if (_.isEmpty(newFilter.track)) {
38+
delete newFilter.track;
39+
}
3440
}
3541
return newFilter;
3642
}

0 commit comments

Comments
 (0)