Skip to content

Leaderboards fixes #5161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ workflows:
filters:
branches:
only:
- apollo-site
- free
# This is alternate dev env for parallel testing
- "build-qa":
context : org-global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ChallengeHistoryModal extends Component {
challengesOrdered.map(challenge => (
<tr styleName="row" key={`${challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}`}>
<td styleName="name">
<a href={`${config.URL.BASE}/challenges/${challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}/`} styleName="link" target="_blank" rel="noopener noreferrer">
<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">
{challenge.challenge_name || challenge['challenge.challenge_name'] || challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}
</a>
</td>
Expand Down
15 changes: 12 additions & 3 deletions src/shared/components/Leaderboard/LeaderboardTable/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export default function LeaderboardTable(props) {
photoUrl = `${config.CDN.PUBLIC}/avatar/${
encodeURIComponent(photoUrl)}?size=40`;
}
const fulfillment = competitor['tco_leaderboard.fulfillment']
? (parseFloat(competitor['tco_leaderboard.fulfillment']) * 100).toFixed(2).replace(/[.,]00$/, '')
: competitor.fulfillment;
return (
<tr key={competitor.rank}>
<td styleName={`${stylesName}.col-rank`}>{competitor.rank}</td>
Expand Down Expand Up @@ -105,7 +108,7 @@ export default function LeaderboardTable(props) {
</td>
{
isCopilot ? (
<td styleName={`${stylesName}.col-fulfillment`}>{competitor.fulfillment}</td>
<td styleName={`${stylesName}.col-fulfillment`}>{fulfillment}</td>
) : null
}
<td styleName={`${stylesName}.col-challenges`}>{competitor['tco_leaderboard.challenge_count'] || competitor.challengecount}</td>
Expand All @@ -122,7 +125,7 @@ export default function LeaderboardTable(props) {
}
{
isAlgo ? (
<td styleName={`${stylesName}.col-points`}>{competitor['srm_tco19.score']}</td>
<td styleName={`${stylesName}.col-points`}>{competitor['tco_leaderboard.total_score'] || competitor['srm_tco19.score']}</td>
) : null
}
</tr>
Expand All @@ -141,7 +144,13 @@ export default function LeaderboardTable(props) {
<th styleName={`${stylesName}.col-fulfillment`}>Fulfillment</th>
) : null
}
<th styleName={`${stylesName}.col-challenges`}># of Challenges</th>
{
isAlgo ? (
<th styleName={`${stylesName}.col-challenges`}># of Matches</th>
) : (
<th styleName={`${stylesName}.col-challenges`}># of Challenges</th>
)
}
<th styleName={`${stylesName}.col-points`}>Points</th>
{
isTopGear ? (
Expand Down
15 changes: 12 additions & 3 deletions src/shared/components/Leaderboard/PodiumSpot/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ export default function PodiumSpot(props) {
}
let rootStyle = `${stylesName}.PodiumSpot`;
if (PODIUM_ITEM_MODIFIER[competitor.rank]) rootStyle += ` ${stylesName}.PodiumSpot--${PODIUM_ITEM_MODIFIER[competitor.rank]}`;
const fulfillment = competitor['tco_leaderboard.fulfillment']
? (parseFloat(competitor['tco_leaderboard.fulfillment']) * 100).toFixed(2).replace(/[.,]00$/, '')
: competitor.fulfillment;

return (
<div styleName={rootStyle}>
Expand Down Expand Up @@ -175,14 +178,20 @@ export default function PodiumSpot(props) {
{
isCopilot ? (
<div styleName={`${stylesName}.stats`}>
<span styleName={`${stylesName}.value`}>{competitor.fulfillment}</span>
<span styleName={`${stylesName}.value`}>{fulfillment}</span>
<span styleName={`${stylesName}.value-title`}>fulfillment</span>
</div>
) : null
}
<div styleName={`${stylesName}.stats`}>
<span styleName={`${stylesName}.value`}>{competitor['tco_leaderboard.challenge_count'] || competitor.challengecount}</span>
<span styleName={`${stylesName}.value-title`}>challenges</span>
{
isAlgo ? (
<span styleName={`${stylesName}.value-title`}># of matches</span>
) : (
<span styleName={`${stylesName}.value-title`}>challenges</span>
)
}
</div>
<div styleName={`${stylesName}.stats`}>
<span styleName={`${stylesName}.value`}>{formatPoints(competitor['tco_leaderboard.tco_points'] || competitor.points)}</span>
Expand All @@ -207,7 +216,7 @@ export default function PodiumSpot(props) {
{
isAlgo ? (
<div styleName={`${stylesName}.stats`}>
<span styleName={`${stylesName}.value`}>{competitor['srm_tco19.score']}</span>
<span styleName={`${stylesName}.value`}>{competitor['tco_leaderboard.total_score'] || competitor['srm_tco19.score']}</span>
<span styleName={`${stylesName}.value-title`}>total score</span>
</div>
) : null
Expand Down