From ab0213de86f400909154ade23bbc993b0d72ab31 Mon Sep 17 00:00:00 2001 From: Guiqiang Zhang Date: Wed, 8 Apr 2020 09:09:14 +0800 Subject: [PATCH] fix rating on member profile --- src/shared/components/ProfilePage/Stats/index.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/components/ProfilePage/Stats/index.jsx b/src/shared/components/ProfilePage/Stats/index.jsx index 4282c8392c..56bd7cec5e 100644 --- a/src/shared/components/ProfilePage/Stats/index.jsx +++ b/src/shared/components/ProfilePage/Stats/index.jsx @@ -78,6 +78,8 @@ class ProfileStats extends React.Component { const subTrackSummary = getSummary(stats, track, subTrack) || []; const subTrackDetails = getDetails(stats, track, subTrack) || []; const ratingObj = subTrackSummary.filter(k => k.label === 'rating'); + const trackHistory = getHistory(statsHistory, track, subTrack); + const latestTrackHistory = trackHistory.history.pop(); let subTrackRating = ratingObj && ratingObj[0] ? ratingObj[0].value : 0; if (subTrackRating === 0 || !subTrackRating) { // if subtrack has no rating, pick default rating subTrackRating = info.maxRating ? info.maxRating.rating : 0; @@ -185,7 +187,7 @@ class ProfileStats extends React.Component { className={label === 'rating' ? styles.rating : ''} style={{ color: label === 'rating' ? getRatingColor(parseInt(value.replace(/\D/g, ''), 10)) : undefined }} > - {value || '-'} + {(label === 'rating' && latestTrackHistory) ? latestTrackHistory.newRating : (value || '-')} {label === 'rating' && } ) @@ -230,7 +232,7 @@ class ProfileStats extends React.Component { activeGraph === 'history' ? (