Skip to content

Commit 48c3e80

Browse files
Merge pull request #288 from topcoder-platform/feature/filter-update
Filter update
2 parents 06d7a2c + d8f9fff commit 48c3e80

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- attach_workspace:
2929
at: .
3030
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
31-
- run: npm publish
31+
- run: npm publish --tag test-release
3232
# dont change anything
3333
workflows:
3434
version: 2

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
3232
"test": "npm run lint && npm run jest"
3333
},
34-
"version": "1.1.3",
34+
"version": "1000.26.1",
3535
"dependencies": {
3636
"auth0-js": "^6.8.4",
3737
"config": "^3.2.0",

src/services/challenges.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ class ChallengesService {
174174
filter,
175175
) => {
176176
let res = {};
177-
if (_.some(filter.frontFilter.tracks, val => val)) {
177+
if (_.some(filter.frontFilter.tracks, val => val)
178+
&& !_.isEqual(filter.frontFilter.types, [])) {
178179
const query = getFilterUrl(filter.backendFilter, filter.frontFilter);
179180
const url = `${endpoint}?${query}`;
180181
res = await this.private.apiV5.get(url).then(checkErrorV5);

src/utils/challenge/filter.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ function filterByRegistrationOpen(challenge, state) {
106106
* @return {Boolean} True if opp satifies the filter
107107
*/
108108
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);
111111
}
112112

113113
function filterByStartDate(challenge, state) {
@@ -158,10 +158,10 @@ function filterByEvents(challenge, state) {
158158
}
159159

160160
function filterByText(challenge, state) {
161-
if (!state.name) return true;
161+
if (!state.search) return true;
162162
const str = `${challenge.name} ${challenge.tags} ${challenge.platforms} ${challenge.tags}`
163163
.toLowerCase();
164-
return str.includes(state.name.toLowerCase());
164+
return str.includes(state.search.toLowerCase());
165165
}
166166

167167
function filterByTrack(challenge, state) {
@@ -447,14 +447,16 @@ export function setEndDate(state, date) {
447447
/**
448448
* Clones the state and sets the review opportunity type.
449449
* @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
451451
* @return {Object}
452452
*/
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;
456458
const res = _.clone(state);
457-
delete res.reviewOpportunityType;
459+
delete res.reviewOpportunityTypes;
458460
return res;
459461
}
460462

0 commit comments

Comments
 (0)