Skip to content

Commit 7e01e56

Browse files
Merge pull request #6327 from topcoder-platform/stat_marathon_match_link
fix: fix challenge link for marathon in member statics from feedback
2 parents 41bb56a + fc7f57f commit 7e01e56

File tree

3 files changed

+4
-40
lines changed

3 files changed

+4
-40
lines changed

.circleci/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ workflows:
371371
branches:
372372
only:
373373
- develop
374+
- stat_marathon_match_link
374375
# Production builds are exectuted
375376
# when PR is merged to the master
376377
# Don't change anything in this configuration

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

+1-8
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
import React from 'react';
66
import PT from 'prop-types';
77
import './styles.scss';
8-
import _ from 'lodash';
98

109
const ChartTooltip = ({
1110
show, left, top, challengeName,
12-
challengeData, rating, ratingColor, href, onClick,
11+
challengeData, rating, ratingColor, href,
1312
}) => (
1413
<a
1514
styleName="chart-tooltip"
@@ -20,10 +19,6 @@ const ChartTooltip = ({
2019
pointerEvents: href ? 'all' : 'none',
2120
}}
2221
href={href}
23-
onClick={(e) => {
24-
e.preventDefault();
25-
onClick();
26-
}}
2722
>
2823
<div styleName="tooltip-rating" style={{ backgroundColor: ratingColor }}>
2924
{rating}
@@ -49,7 +44,6 @@ ChartTooltip.defaultProps = {
4944
rating: 0,
5045
ratingColor: '',
5146
href: null,
52-
onClick: _.noop,
5347
};
5448

5549
ChartTooltip.propTypes = {
@@ -61,7 +55,6 @@ ChartTooltip.propTypes = {
6155
rating: PT.number,
6256
ratingColor: PT.string,
6357
href: PT.string,
64-
onClick: PT.func,
6558
};
6659

6760
export default ChartTooltip;

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

+2-32
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export default class HistoryGraph extends React.Component {
1515
this.state = {};
1616
this.mobileWidth = 0;
1717
this.graphRef = React.createRef();
18-
this.onHandleDataPointClicked = this.onHandleDataPointClicked.bind(this);
1918
}
2019

2120
componentDidMount() {
@@ -59,23 +58,6 @@ export default class HistoryGraph extends React.Component {
5958
return 300;
6059
}
6160

62-
onHandleDataPointClicked() {
63-
const { challengeId, href } = this.state;
64-
fetch(`${config.API.V5}/challenges?legacyId=${challengeId}`)
65-
.then(result => result.json())
66-
.then((dataResponse) => {
67-
if (dataResponse.length > 0) {
68-
const challenge = dataResponse[0];
69-
window.location.href = `${config.URL.CHALLENGES_URL}/${challenge.id}`;
70-
} else {
71-
window.location.href = href;
72-
}
73-
}).catch(() => {
74-
window.location.href = href;
75-
});
76-
}
77-
78-
7961
draw() {
8062
const $scope = this;
8163
const { history: wrapper, track, subTrack } = this.props;
@@ -230,7 +212,7 @@ export default class HistoryGraph extends React.Component {
230212
}
231213
if (track === 'DATA_SCIENCE') {
232214
if (subTrack === 'MARATHON_MATCH') {
233-
return `${config.URL.COMMUNITY}/tc?module=MatchDetails&rd=${challengeId}`;
215+
return `${config.URL.CHALLENGES_URL}/${challengeId}`;
234216
}
235217
if (subTrack === 'SRM') {
236218
return `${config.URL.COMMUNITY}/stat?c=round_overview&rd=${challengeId}`;
@@ -265,7 +247,6 @@ export default class HistoryGraph extends React.Component {
265247
show: true,
266248
left: e.pageX,
267249
top: e.pageY,
268-
challengeId: d.challengeId,
269250
challengeName: d.challengeName,
270251
challengeData: moment(d.ratingDate).format('MMM DD, YYYY'),
271252
rating: d.newRating,
@@ -278,18 +259,7 @@ export default class HistoryGraph extends React.Component {
278259
render() {
279260
return (
280261
<div styleName="history-graph" ref={this.graphRef}>
281-
<ChartTooltip
282-
{...this.state}
283-
onClick={() => {
284-
const { track } = this.props;
285-
const { href } = this.state;
286-
if (track === 'DATA_SCIENCE') {
287-
this.onHandleDataPointClicked();
288-
} else {
289-
window.location.href = href;
290-
}
291-
}}
292-
/>
262+
<ChartTooltip {...this.state} />
293263
</div>
294264
);
295265
}

0 commit comments

Comments
 (0)