Skip to content

Commit b9e43aa

Browse files
Merge branch 'develop' into fix_for_job_description
2 parents 4f368ea + 12d27f6 commit b9e43aa

File tree

22 files changed

+219
-97
lines changed

22 files changed

+219
-97
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ workflows:
230230
filters:
231231
branches:
232232
only:
233-
- fix_for_job_description
233+
- develop
234234
# This is alternate dev env for parallel testing
235235
- "build-test":
236236
context : org-global
237237
filters:
238238
branches:
239239
only:
240-
- apollo-site
240+
- free
241241
# This is alternate dev env for parallel testing
242242
- "build-qa":
243243
context : org-global

__tests__/shared/components/ChallengeTile/__snapshots__/index.jsx.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,6 @@ exports[`renders marathon 1`] = `
241241
</p>
242242
</div>
243243
</div>
244-
<p
245-
className="src-shared-components-ChallengeTile-___style__roles___1V-WA"
246-
/>
247244
</div>
248245
</div>
249246
</div>

__tests__/shared/components/SubmissionManagement/Submission.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Submission from 'components/SubmissionManagement/Submission';
44
import TU from 'react-dom/test-utils';
55

66
const mockOnDelete = jest.fn();
7+
const mockOnDownload = jest.fn();
78
const mockOnShowDetails = jest.fn();
89

910
const rnd = new Rnd();
@@ -12,6 +13,7 @@ test('Snapshot match', () => {
1213
rnd.render((
1314
<Submission
1415
onDelete={mockOnDelete}
16+
onDownload={mockOnDownload}
1517
onShowDetails={mockOnShowDetails}
1618
showScreeningDetails
1719
type="develop"
@@ -21,6 +23,7 @@ test('Snapshot match', () => {
2123
rnd.render((
2224
<Submission
2325
onDelete={mockOnDelete}
26+
onDownload={mockOnDownload}
2427
onShowDetails={mockOnShowDetails}
2528
submissionObject={{
2629
id: '12345',
@@ -49,6 +52,7 @@ class Wrapper extends React.Component {
4952
const page = TU.renderIntoDocument((
5053
<Wrapper
5154
onDelete={mockOnDelete}
55+
onDownload={mockOnDownload}
5256
onShowDetails={mockOnShowDetails}
5357
submissionObject={{
5458
id: '12345',

__tests__/shared/components/SubmissionManagement/__snapshots__/Submission.jsx.snap

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ exports[`Snapshot match 1`] = `
2121
className="src-shared-components-SubmissionManagement-Submission-___styles__action-col___2M1RY"
2222
>
2323
<div>
24-
<a>
24+
<button
25+
onClick={[Function]}
26+
type="button"
27+
>
2528
<DownloadIcon
2629
height="16"
2730
viewBox="0 0 16 16"
2831
width="16"
2932
xmlns="http://www.w3.org/2000/svg"
3033
/>
31-
</a>
34+
</button>
3235
<button
3336
className="src-shared-components-SubmissionManagement-Submission-___styles__delete-icon___2M67z"
3437
disabled={true}
@@ -81,14 +84,17 @@ exports[`Snapshot match 2`] = `
8184
className="src-shared-components-SubmissionManagement-Submission-___styles__action-col___2M1RY"
8285
>
8386
<div>
84-
<a>
87+
<button
88+
onClick={[Function]}
89+
type="button"
90+
>
8591
<DownloadIcon
8692
height="16"
8793
viewBox="0 0 16 16"
8894
width="16"
8995
xmlns="http://www.w3.org/2000/svg"
9096
/>
91-
</a>
97+
</button>
9298
<button
9399
className="src-shared-components-SubmissionManagement-Submission-___styles__delete-icon___2M67z"
94100
disabled={true}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
"supertest": "^3.1.0",
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.25.6",
143+
"topcoder-react-lib": "1000.25.8",
144144
"topcoder-react-ui-kit": "2.0.1",
145145
"topcoder-react-utils": "0.7.8",
146146
"turndown": "^4.0.2",

src/shared/actions/page/challenge-details.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function setSpecsTabState(state) {
5959
* @param {Boolean} open
6060
* @return {Object}
6161
*/
62-
function toggleCheckpointFeedback(id, open) {
62+
function toggleCheckpointFeedback(id, open = false) {
6363
return { id, open };
6464
}
6565

src/shared/components/ChallengeTile/index.jsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Challenge tile.
33
*/
44
/* eslint-env browser */
5+
import _ from 'lodash';
56
import React from 'react';
67
import PT from 'prop-types';
78
import { Link } from 'react-router-dom';
@@ -74,6 +75,7 @@ class ChallengeTile extends React.Component {
7475
} = this.props;
7576

7677
const { track, type } = challenge;
78+
const roles = _.get(challenge, 'userDetails.roles');
7779

7880
const outStyleName = `challenge tile-view ${track.replace(' ', '-').toLowerCase()}`;
7981
const extraStyle = {
@@ -307,19 +309,22 @@ class ChallengeTile extends React.Component {
307309
) }
308310
</div>
309311

310-
<p styleName="roles">
311-
{ track !== COMPETITION_TRACKS.DS
312+
{ !_.isEmpty(roles)
313+
&& (
314+
<p styleName="roles">
315+
{ track !== COMPETITION_TRACKS.DS
312316
&& (
313317
<span>
314318
<span>
315319
Role: &nbsp;
316320
</span>
317321
<span>
318-
{ listRoles(challenge.userDetails.roles) }
322+
{ listRoles(roles) }
319323
</span>
320324
</span>
321325
) }
322-
</p>
326+
</p>
327+
) }
323328
</div>
324329
</div>
325330
</div>

src/shared/components/Leaderboard/ChallengeHistoryModal/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class ChallengeHistoryModal extends Component {
116116
challengesOrdered.map(challenge => (
117117
<tr styleName="row" key={`${challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}`}>
118118
<td styleName="name">
119-
<a href={`${config.URL.BASE}/challenges/${challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}/`} styleName="link" target="_blank" rel="noopener noreferrer">
119+
<a href={`${config.URL.BASE}/challenges/${challenge['tco_leaderboard.challenge_id'] || challenge['challenge.challenge_id'] || challenge.challenge_id}/`} styleName="link" target="_blank" rel="noopener noreferrer">
120120
{challenge.challenge_name || challenge['challenge.challenge_name'] || challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}
121121
</a>
122122
</td>

src/shared/components/Leaderboard/LeaderboardTable/index.jsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ export default function LeaderboardTable(props) {
6565
photoUrl = `${config.CDN.PUBLIC}/avatar/${
6666
encodeURIComponent(photoUrl)}?size=40`;
6767
}
68+
const fulfillment = competitor['tco_leaderboard.fulfillment']
69+
? (parseFloat(competitor['tco_leaderboard.fulfillment']) * 100).toFixed(2).replace(/[.,]00$/, '')
70+
: competitor.fulfillment;
6871
return (
6972
<tr key={competitor.rank}>
7073
<td styleName={`${stylesName}.col-rank`}>{competitor.rank}</td>
@@ -105,7 +108,7 @@ export default function LeaderboardTable(props) {
105108
</td>
106109
{
107110
isCopilot ? (
108-
<td styleName={`${stylesName}.col-fulfillment`}>{competitor.fulfillment}</td>
111+
<td styleName={`${stylesName}.col-fulfillment`}>{fulfillment}</td>
109112
) : null
110113
}
111114
<td styleName={`${stylesName}.col-challenges`}>{competitor['tco_leaderboard.challenge_count'] || competitor.challengecount}</td>
@@ -122,7 +125,7 @@ export default function LeaderboardTable(props) {
122125
}
123126
{
124127
isAlgo ? (
125-
<td styleName={`${stylesName}.col-points`}>{competitor['srm_tco19.score']}</td>
128+
<td styleName={`${stylesName}.col-points`}>{competitor['tco_leaderboard.total_score'] || competitor['srm_tco19.score']}</td>
126129
) : null
127130
}
128131
</tr>
@@ -141,7 +144,13 @@ export default function LeaderboardTable(props) {
141144
<th styleName={`${stylesName}.col-fulfillment`}>Fulfillment</th>
142145
) : null
143146
}
144-
<th styleName={`${stylesName}.col-challenges`}># of Challenges</th>
147+
{
148+
isAlgo ? (
149+
<th styleName={`${stylesName}.col-challenges`}># of Matches</th>
150+
) : (
151+
<th styleName={`${stylesName}.col-challenges`}># of Challenges</th>
152+
)
153+
}
145154
<th styleName={`${stylesName}.col-points`}>Points</th>
146155
{
147156
isTopGear ? (

src/shared/components/Leaderboard/PodiumSpot/index.jsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ export default function PodiumSpot(props) {
107107
}
108108
let rootStyle = `${stylesName}.PodiumSpot`;
109109
if (PODIUM_ITEM_MODIFIER[competitor.rank]) rootStyle += ` ${stylesName}.PodiumSpot--${PODIUM_ITEM_MODIFIER[competitor.rank]}`;
110+
const fulfillment = competitor['tco_leaderboard.fulfillment']
111+
? (parseFloat(competitor['tco_leaderboard.fulfillment']) * 100).toFixed(2).replace(/[.,]00$/, '')
112+
: competitor.fulfillment;
110113

111114
return (
112115
<div styleName={rootStyle}>
@@ -175,14 +178,20 @@ export default function PodiumSpot(props) {
175178
{
176179
isCopilot ? (
177180
<div styleName={`${stylesName}.stats`}>
178-
<span styleName={`${stylesName}.value`}>{competitor.fulfillment}</span>
181+
<span styleName={`${stylesName}.value`}>{fulfillment}</span>
179182
<span styleName={`${stylesName}.value-title`}>fulfillment</span>
180183
</div>
181184
) : null
182185
}
183186
<div styleName={`${stylesName}.stats`}>
184187
<span styleName={`${stylesName}.value`}>{competitor['tco_leaderboard.challenge_count'] || competitor.challengecount}</span>
185-
<span styleName={`${stylesName}.value-title`}>challenges</span>
188+
{
189+
isAlgo ? (
190+
<span styleName={`${stylesName}.value-title`}># of matches</span>
191+
) : (
192+
<span styleName={`${stylesName}.value-title`}>challenges</span>
193+
)
194+
}
186195
</div>
187196
<div styleName={`${stylesName}.stats`}>
188197
<span styleName={`${stylesName}.value`}>{formatPoints(competitor['tco_leaderboard.tco_points'] || competitor.points)}</span>
@@ -207,7 +216,7 @@ export default function PodiumSpot(props) {
207216
{
208217
isAlgo ? (
209218
<div styleName={`${stylesName}.stats`}>
210-
<span styleName={`${stylesName}.value`}>{competitor['srm_tco19.score']}</span>
219+
<span styleName={`${stylesName}.value`}>{competitor['tco_leaderboard.total_score'] || competitor['srm_tco19.score']}</span>
211220
<span styleName={`${stylesName}.value-title`}>total score</span>
212221
</div>
213222
) : null

src/shared/components/ProfilePage/Stats/SubTrackChallengeView/index.jsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import shortId from 'shortid';
1313
import ChallengeTile from 'components/ChallengeTile';
1414
import SRMTile from 'components/SRMTile';
1515
import { actions } from 'topcoder-react-lib';
16+
import { OLD_COMPETITION_TRACKS, COMPETITION_TRACKS } from 'utils/tc';
1617
import LoadingIndicator from 'components/LoadingIndicator';
1718
import GalleryModal from './GalleryModal';
1819
import './style.scss';
@@ -104,6 +105,27 @@ const processPastChallenge = (challenge) => {
104105
} else {
105106
cloned.numImages = 0;
106107
}
108+
109+
if (!cloned.type) {
110+
cloned.type = cloned.subTrack;
111+
}
112+
113+
switch (cloned.track) {
114+
case OLD_COMPETITION_TRACKS.DATA_SCIENCE:
115+
cloned.track = COMPETITION_TRACKS.DS;
116+
break;
117+
case OLD_COMPETITION_TRACKS.DESIGN:
118+
cloned.track = COMPETITION_TRACKS.DES;
119+
break;
120+
case OLD_COMPETITION_TRACKS.DEVELOP:
121+
cloned.track = COMPETITION_TRACKS.DEV;
122+
break;
123+
case OLD_COMPETITION_TRACKS.QA:
124+
cloned.track = COMPETITION_TRACKS.QA;
125+
break;
126+
default:
127+
break;
128+
}
107129
}
108130
return cloned;
109131
};
@@ -421,7 +443,6 @@ function mapDispatchToProps(dispatch) {
421443
pageNum,
422444
pageSize,
423445
refresh,
424-
userId,
425446
) => {
426447
const uuid = shortId();
427448
dispatch(action.getSubtrackChallengesInit(handle, uuid));
@@ -434,7 +455,6 @@ function mapDispatchToProps(dispatch) {
434455
pageNum,
435456
pageSize,
436457
refresh,
437-
userId,
438458
));
439459
},
440460
loadSRM: (handle, tokenV3, pageNum, pageSize, refresh) => {

0 commit comments

Comments
 (0)