Skip to content

Commit 92b729e

Browse files
committed
fix lint issues
1 parent ee64e3e commit 92b729e

File tree

1 file changed

+9
-10
lines changed
  • src/shared/components/ProfilePage/Stats

1 file changed

+9
-10
lines changed

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

+9-10
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
* Stats Page. Displays the stats of a TopCoder member.
33
*/
44
/* eslint-env browser */
5-
import { _, get } from 'lodash';
5+
import _ from 'lodash';
66
import React from 'react';
77
import PT from 'prop-types';
88
import { Link } from 'react-router-dom';
99
import { getRatingColor } from 'utils/tc';
1010
import Th from 'assets/images/th.svg';
11+
import DefaultPortrait from 'assets/images/ico-user-default.svg';
1112
import {
1213
shouldShowGraph, getHistory, getSubTrackStats, getSummary, getDetails,
1314
} from 'utils/memberStats';
@@ -17,7 +18,6 @@ import styles from './styles.scss';
1718
import StatsModal from './StatsModal';
1819
import SRMStats from './SRMStats';
1920
import SubTrackChallengeView from './SubTrackChallengeView';
20-
import DefaultPortrait from 'assets/images/ico-user-default.svg';
2121

2222

2323
class ProfileStats extends React.Component {
@@ -65,11 +65,8 @@ class ProfileStats extends React.Component {
6565
const subTrackStats = getSubTrackStats(stats, track, subTrack);
6666
const subTrackSummary = getSummary(stats, track, subTrack) || [];
6767
const subTrackDetails = getDetails(stats, track, subTrack) || [];
68-
let srmRating = 0;
69-
const ratingObj = subTrackSummary.filter((k) => k.label === 'rating');
70-
if (ratingObj) {
71-
srmRating = ratingObj[0].value;
72-
}
68+
const ratingObj = subTrackSummary.filter(k => k.label === 'rating');
69+
const subTrackRating = ratingObj ? ratingObj[0].value : 0;
7370

7471
if (track === 'DEVELOP') {
7572
const reliability = subTrackSummary.find(stat => stat.label === 'reliability');
@@ -135,19 +132,21 @@ Active Challenges
135132
</ul>
136133
<ul styleName="subtrack-stats">
137134
{
138-
subTrackSummary && info &&
135+
subTrackSummary
136+
&& (
139137
<li key={info.handle}>
140138
<div>
141139
{ info.photoURL ? <img src={info.photoURL} onError={this.loadImageError} styleName="profile-circle" alt="Member Portait" /> : <DefaultPortrait styleName="profile-circle" /> }
142140
</div>
143141
<div
144142
styleName="value"
145143
className={info.maxRating ? styles.rating : ''}
146-
style={{ color: srmRating ? getRatingColor(parseInt(srmRating.replace(/\D/g, ''), 10)) : undefined }}
147-
>
144+
style={{ color: subTrackRating ? getRatingColor(parseInt(subTrackRating.replace(/\D/g, ''), 10)) : undefined }}
145+
>
148146
{info.handle || '-'}
149147
</div>
150148
</li>
149+
)
151150
}
152151
{
153152
subTrackSummary.map(({ label, value, link }) => (

0 commit comments

Comments
 (0)