Skip to content

Commit acfa6c6

Browse files
Merge branch 'listing-develop-sync' into issue-5003
2 parents 0f0cae7 + e787563 commit acfa6c6

File tree

27 files changed

+423
-69
lines changed

27 files changed

+423
-69
lines changed

.circleci/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,15 @@ workflows:
237237
filters:
238238
branches:
239239
only:
240-
- listing-develop-sync
240+
- develop
241241
# This is alternate dev env for parallel testing
242242
- "build-qa":
243243
context : org-global
244244
filters:
245245
branches:
246246
only:
247-
- gig-application
247+
- develop
248+
- listing-develop-sync
248249
# This is beta env for production soft releases
249250
- "build-prod-beta":
250251
context : org-global

__tests__/shared/components/GUIKit/TextInput/__snapshots__/index.jsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ exports[`Default render 1`] = `
77
<input
88
className=""
99
defaultValue=""
10+
onBlur={[Function]}
1011
onChange={[Function]}
1112
placeholder=""
1213
type="text"

__tests__/shared/components/challenge-listing/Filters/FiltersPanel.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ const mockDatas = [{
1515
{
1616
communityId: '123',
1717
communityName: 'Sample community',
18+
groupIds: ['123'],
1819
},
1920
],
21+
challengeFilter: {
22+
groupIds: ['123'],
23+
},
2024
filterState: {
2125
groups: [],
2226
},
@@ -34,8 +38,12 @@ const mockDatas = [{
3438
{
3539
communityId: '123',
3640
communityName: 'Sample community',
41+
groupIds: ['123'],
3742
},
3843
],
44+
challengeFilter: {
45+
groupIds: ['123'],
46+
},
3947
filterState: {
4048
groups: [],
4149
},

__tests__/shared/components/challenge-listing/Filters/__snapshots__/FiltersPanel.jsx.snap

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,18 @@ exports[`Matches shallow shapshot 1`] = `
8282
clearable={false}
8383
id="community-select"
8484
onChange={[Function]}
85-
options={Array []}
85+
options={
86+
Array [
87+
Object {
88+
"data": <div>
89+
Sample community
90+
</div>,
91+
"label": "Sample community",
92+
"name": "Sample community",
93+
"value": "123",
94+
},
95+
]
96+
}
8697
selectRef={[Function]}
8798
simpleValue={true}
8899
value=""
@@ -267,7 +278,18 @@ exports[`Matches shallow shapshot 2`] = `
267278
clearable={false}
268279
id="community-select"
269280
onChange={[Function]}
270-
options={Array []}
281+
options={
282+
Array [
283+
Object {
284+
"data": <div>
285+
Sample community
286+
</div>,
287+
"label": "Sample community",
288+
"name": "Sample community",
289+
"value": "123",
290+
},
291+
]
292+
}
271293
selectRef={[Function]}
272294
simpleValue={true}
273295
value=""

__tests__/shared/components/challenge-listing/__snapshots__/index.jsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ exports[`Matches shallow shapshot 1 shapshot 1 1`] = `
2828
expanding={false}
2929
filterState={Object {}}
3030
loadMoreActive={null}
31+
loadMoreAll={null}
3132
loadMoreMy={null}
3233
loadMoreOnGoing={null}
3334
loadMoreOpenForRegistration={null}
@@ -93,6 +94,7 @@ exports[`Matches shallow shapshot 2 shapshot 2 1`] = `
9394
expanding={false}
9495
filterState={Object {}}
9596
loadMoreActive={null}
97+
loadMoreAll={null}
9698
loadMoreMy={null}
9799
loadMoreOnGoing={null}
98100
loadMoreOpenForRegistration={null}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
"tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev",
141141
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3",
142142
"tc-ui": "^1.0.12",
143-
"topcoder-react-lib": "1000.24.3",
143+
"topcoder-react-lib": "1000.24.5",
144144
"topcoder-react-ui-kit": "2.0.1",
145145
"topcoder-react-utils": "0.7.8",
146146
"turndown": "^4.0.2",

src/server/services/recruitCRM.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,29 @@ export default class RecruitCRMService {
288288
errObj,
289289
});
290290
}
291+
// Set hired-stage
292+
const hireStageResponse = await fetch(`${this.private.baseUrl}/v1/candidates/${candidateData.slug}/hiring-stages/${id}`, {
293+
method: 'POST',
294+
headers: {
295+
'Content-Type': 'application/json',
296+
Authorization: this.private.authorization,
297+
},
298+
body: JSON.stringify({
299+
candidate_slug: candidateData.slug,
300+
job_slug: id,
301+
status_id: '10',
302+
}),
303+
});
304+
if (hireStageResponse.status >= 400) {
305+
return res.send({
306+
error: true,
307+
status: hireStageResponse.status,
308+
url: `$${this.private.baseUrl}/v1/candidates/${candidateData.slug}/hiring-stages/${id}`,
309+
form,
310+
errObj: await hireStageResponse.json(),
311+
});
312+
}
313+
// respond to API call
291314
const data = await applyResponse.json();
292315
return res.send(data);
293316
} catch (err) {

src/shared/actions/challenge-listing/index.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ function getMyChallengesInit(uuid, page, frontFilter) {
8787
return { uuid, page, frontFilter };
8888
}
8989

90+
function getAllChallengesInit(uuid, page, frontFilter) {
91+
return { uuid, page, frontFilter };
92+
}
93+
9094
/**
9195
* Get all challenges and match with user challenges
9296
* @param {String} uuid progress id
@@ -270,6 +274,31 @@ function getMyChallengesDone(uuid, page, backendFilter, tokenV3, frontFilter = {
270274
}));
271275
}
272276

277+
function getAllChallengesDone(uuid, page, backendFilter, tokenV3, frontFilter = {}) {
278+
const { sorts, status } = frontFilter;
279+
const filter = {
280+
backendFilter,
281+
frontFilter: {
282+
...frontFilter,
283+
perPage: PAGE_SIZE,
284+
page: page + 1,
285+
sortBy: sorts[BUCKETS.ALL],
286+
sortOrder: SORT[sorts[BUCKETS.ALL]].order,
287+
},
288+
};
289+
delete filter.frontFilter.sorts;
290+
if (status === 'All') {
291+
delete filter.frontFilter.status;
292+
}
293+
const service = getService(tokenV3);
294+
return service.getChallenges(filter).then(ch => ({
295+
uuid,
296+
allChallenges: ch.challenges,
297+
meta: ch.meta,
298+
frontFilter,
299+
}));
300+
}
301+
273302
function getTotalChallengesCountInit(uuid) {
274303
return { uuid };
275304
}
@@ -463,6 +492,7 @@ export default createActions({
463492
DROP_ACTIVE_CHALLENGES: _.noop,
464493
DROP_OPEN_FOR_REGISTRATION_CHALLENGES: _.noop,
465494
DROP_MY_CHALLENGES: _.noop,
495+
DROP_ALL_CHALLENGES: _.noop,
466496
DROP_PAST_CHALLENGES: _.noop,
467497

468498
// GET_ALL_ACTIVE_CHALLENGES_INIT: getAllActiveChallengesInit,
@@ -474,6 +504,9 @@ export default createActions({
474504
// GET_ALL_RECOMMENDED_CHALLENGES_INIT: getAllRecommendedChallengesInit,
475505
// GET_ALL_RECOMMENDED_CHALLENGES_DONE: getAllRecommendedChallengesDone,
476506

507+
GET_ALL_CHALLENGES_INIT: getAllChallengesInit,
508+
GET_ALL_CHALLENGES_DONE: getAllChallengesDone,
509+
477510
GET_ACTIVE_CHALLENGES_INIT: getActiveChallengesInit,
478511
GET_ACTIVE_CHALLENGES_DONE: getActiveChallengesDone,
479512

src/shared/components/GUIKit/TextInput/index.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ function TextInput({
3535
delayedOnChange(e.target.value, onChange);
3636
setVal(e.target.value);
3737
}}
38+
onBlur={(e) => {
39+
delayedOnChange(e.target.value, onChange);
40+
setVal(e.target.value);
41+
}}
3842
/>
3943
{label ? (
4044
<label htmlFor="textBoxInput">

src/shared/components/challenge-detail/Header/ChallengeTags.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ export default function ChallengeTags(props) {
6363
&& (
6464
<TrackTag
6565
onClick={() => (
66-
setImmediate(() => setChallengeListingFilter({ types: [challengeType.id] }))
66+
setImmediate(() => setChallengeListingFilter({ types: [challengeType.abbreviation] }))
6767
)
6868
}
69-
to={`${challengesUrl}?filter[types][0]=${encodeURIComponent(challengeType.id)}`}
69+
to={`${challengesUrl}?types[]=${encodeURIComponent(challengeType.abbreviation)}`}
7070
>
7171
{challengeType.name}
7272
</TrackTag>
@@ -90,7 +90,7 @@ export default function ChallengeTags(props) {
9090
key={tag}
9191
onClick={() => setImmediate(() => setChallengeListingFilter({ tags: [tag] }))
9292
}
93-
to={`${challengesUrl}?filter[tags][0]=${
93+
to={`${challengesUrl}?tags[]=${
9494
encodeURIComponent(tag)}`}
9595
>
9696
{tag}

src/shared/components/challenge-detail/Header/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export default function ChallengeHeader(props) {
204204
}
205205
}
206206

207-
const checkpointCount = checkpoints && checkpoints.numberOfUniqueSubmitters;
207+
const checkpointCount = checkpoints && checkpoints.numberOfPassedScreeningSubmissions;
208208

209209
let nextDeadlineMsg;
210210
switch ((status || '').toLowerCase()) {

src/shared/components/challenge-detail/Specification/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default function ChallengeDetailsView(props) {
6161
let stockArtValue = '';
6262
const allowStockArt = _.find(metadata, { name: 'allowStockArt' });
6363
if (allowStockArt) {
64-
stockArtValue = allowStockArt.value;
64+
stockArtValue = allowStockArt.value === 'true';
6565
}
6666

6767
let environment = '';

src/shared/components/challenge-listing/Filters/ChallengeFilters.jsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import React from 'react';
55
import PT from 'prop-types';
66
import SwitchWithLabel from 'components/SwitchWithLabel';
7-
// import { challenge as challengeUtils } from 'topcoder-react-lib';
7+
import { challenge as challengeUtils } from 'topcoder-react-lib';
88
// import { COMPETITION_TRACKS as TRACKS } from 'utils/tc';
99
import _ from 'lodash';
1010

@@ -17,7 +17,7 @@ import FiltersSwitch from './FiltersSwitch';
1717

1818
import './ChallengeFilters.scss';
1919

20-
// const Filter = challengeUtils.filter;
20+
const Filter = challengeUtils.filter;
2121

2222
export default function ChallengeFilters({
2323
communityFilters,
@@ -30,6 +30,7 @@ export default function ChallengeFilters({
3030
auth,
3131
// isCardTypeSet,
3232
isReviewOpportunitiesBucket,
33+
activeBucket,
3334
// saveFilter,
3435
searchText,
3536
selectCommunity,
@@ -45,17 +46,20 @@ export default function ChallengeFilters({
4546
}) {
4647
let filterRulesCount = 0;
4748
if (filterState.groups && filterState.groups.length) filterRulesCount += 1;
49+
if (filterState.events && filterState.events.length) filterRulesCount += 1;
4850
if (filterState.tags && filterState.tags.length) filterRulesCount += 1;
4951
if (filterState.types && filterState.types.length) filterRulesCount += 1;
50-
if (filterState.endDateEnd || filterState.startDateStart) filterRulesCount += 1;
52+
if (filterState.endDateStart || filterState.startDateEnd) {
53+
filterRulesCount += 1;
54+
}
5155
if (isReviewOpportunitiesBucket && filterState.reviewOpportunityType) filterRulesCount += 1;
5256
if (selectedCommunityId !== '' && selectedCommunityId !== 'All') filterRulesCount += 1;
53-
const isTrackOn = track => filterState.tracks[track];
57+
const isTrackOn = track => filterState.tracks && filterState.tracks[track];
5458

5559
const switchTrack = (track, on) => {
56-
const newFilter = _.cloneDeep(filterState);
57-
newFilter.tracks[track] = on;
58-
setFilterState({ ...newFilter });
60+
const act = on ? Filter.addTrack : Filter.removeTrack;
61+
const filterObj = act(filterState, track);
62+
setFilterState({ ...filterObj });
5963
};
6064

6165
const clearSearch = () => {
@@ -168,6 +172,7 @@ export default function ChallengeFilters({
168172
isAuth={isAuth}
169173
auth={auth}
170174
isReviewOpportunitiesBucket={isReviewOpportunitiesBucket}
175+
activeBucket={activeBucket}
171176
filterState={filterState}
172177
onClose={() => setExpanded(false)}
173178
// onSaveFilter={saveFilter}
@@ -209,6 +214,7 @@ ChallengeFilters.propTypes = {
209214
communityFilters: PT.arrayOf(PT.shape()).isRequired,
210215
communityName: PT.string,
211216
defaultCommunityId: PT.string.isRequired,
217+
activeBucket: PT.string.isRequired,
212218
// challenges: PT.arrayOf(PT.shape()),
213219
expanded: PT.bool.isRequired,
214220
filterState: PT.shape().isRequired,

0 commit comments

Comments
 (0)