Skip to content

Commit 5315352

Browse files
Merge pull request #303 from topcoder-platform/feature/recommender-sync-develop
Feature/recommender sync develop
2 parents 99e6aa4 + 5f27361 commit 5315352

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
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-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
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.6",
34+
"version": "1000.27.8",
3535
"dependencies": {
3636
"auth0-js": "^6.8.4",
3737
"config": "^3.2.0",

src/services/challenges.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ class ChallengesService {
185185
totalCount: res.headers ? res.headers.get('x-total') : 0,
186186
meta: {
187187
allChallengesCount: res.headers ? res.headers.get('x-total') : 0,
188+
allRecommendedChallengesCount: 0,
188189
myChallengesCount: 0,
189190
ongoingChallengesCount: 0,
190191
openChallengesCount: 0,
@@ -527,6 +528,43 @@ class ChallengesService {
527528
});
528529
}
529530

531+
/**
532+
* Gets challenges.
533+
* @param {Object} filters Optional.
534+
* @param {Object} params Optional.
535+
* @param {String} handle user handle
536+
* @return {Promise} Resolves to the api response.
537+
*/
538+
async getRecommendedChallenges(filter, handle) {
539+
filter.frontFilter.per_page = filter.frontFilter.perPage;
540+
delete filter.frontFilter.perPage;
541+
542+
const query = getFilterUrl(filter.backendFilter, filter.frontFilter);
543+
544+
let res = {};
545+
let totalCount = 0;
546+
if (_.some(filter.frontFilter.tracks, val => val)
547+
&& !_.isEqual(filter.frontFilter.types, [])) {
548+
const url = `/recommender-api/${handle}?${query}`;
549+
res = await this.private.apiV5.get(url).then(checkErrorV5);
550+
totalCount = res.headers.get('x-total') || 0;
551+
}
552+
553+
const challenges = res.result ? res.result.filter(ch => ch.jaccard_index > 0) : [];
554+
return {
555+
challenges,
556+
totalCount,
557+
meta: {
558+
allChallengesCount: totalCount,
559+
allRecommendedChallengesCount: 0,
560+
myChallengesCount: 0,
561+
ongoingChallengesCount: 0,
562+
openChallengesCount: 0,
563+
totalCount,
564+
},
565+
};
566+
}
567+
530568
/**
531569
* Gets SRM matches.
532570
* @param {Object} params

0 commit comments

Comments
 (0)