Skip to content

Commit c21a791

Browse files
committed
Add Handle and image to all stats pages including copilot
1 parent 0041e45 commit c21a791

File tree

1 file changed

+7
-5
lines changed
  • src/shared/components/ProfilePage/Stats

1 file changed

+7
-5
lines changed

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

+7-5
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ class ProfileStats extends React.Component {
6767
const subTrackSummary = getSummary(stats, track, subTrack) || [];
6868
const subTrackDetails = getDetails(stats, track, subTrack) || [];
6969
const ratingObj = subTrackSummary.filter(k => k.label === 'rating');
70-
const subTrackRating = ratingObj ? ratingObj[0].value : 0;
71-
const isSRM = subTrack === 'SRM';
70+
let subTrackRating = ratingObj && ratingObj[0] ? ratingObj[0].value : 0;
71+
if (subTrackRating === 0 || !subTrackRating) { // if subtrack has no rating, pick default rating
72+
subTrackRating = info.maxRating ? info.maxRating.rating : 0;
73+
}
7274

7375
if (track === 'DEVELOP') {
7476
const reliability = subTrackSummary.find(stat => stat.label === 'reliability');
@@ -138,16 +140,16 @@ Active Challenges
138140
</ul>
139141
<ul styleName="subtrack-stats">
140142
{
141-
isSRM && subTrackSummary
143+
subTrackSummary
142144
&& (
143145
<li key={info.handle}>
144146
<div>
145147
{ info.photoURL ? <img src={info.photoURL} onError={this.loadImageError} styleName="profile-circle" alt="Member Portait" /> : <DefaultPortrait styleName="profile-circle" /> }
146148
</div>
147149
<div
148150
styleName="valueHandle"
149-
className={info.maxRating ? styles.rating : ''}
150-
style={{ color: subTrackRating ? getRatingColor(parseInt(subTrackRating.replace(/\D/g, ''), 10)) : undefined }}
151+
className={subTrackRating ? styles.rating : ''}
152+
style={{ color: subTrackRating ? getRatingColor(parseInt(subTrackRating.toString().replace(/\D/g, ''), 10)) : undefined }}
151153
>
152154
<Link to={`/members/${info.handle}`}>
153155
{info.handle || '-'}

0 commit comments

Comments
 (0)