diff --git a/.circleci/config.yml b/.circleci/config.yml index 98598b1da3..c94aa0f975 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -275,7 +275,7 @@ workflows: filters: branches: only: - - gig-referrals + - develop # This is alternate dev env for parallel testing - "build-test": context : org-global diff --git a/src/shared/actions/leaderboard.js b/src/shared/actions/leaderboard.js index b379260372..7547b1cd4a 100644 --- a/src/shared/actions/leaderboard.js +++ b/src/shared/actions/leaderboard.js @@ -1,9 +1,8 @@ +/* eslint-disable no-param-reassign */ /** * Leaderboard actions. */ -/* global fetch */ /* eslint no-param-reassign: ["error", { "props": false }] */ - import _ from 'lodash'; import { createActions } from 'redux-actions'; @@ -34,10 +33,19 @@ function fetchLeaderboard(auth, apiUrl, id) { }); } +/** + * Prepare loading looker for TCO history modal + * @param {string} url the url to load data from + */ function getTcoHistoryChallengesInit(url) { return _.toString(url); } +/** + * Loads looker for TCO history modal + * @param {string} url the url to load data from + * @param {object} competitor the competitor data + */ async function getTcoHistoryChallengesDone(url, competitor) { const res = await fetch(url) .then(response => response.json()) @@ -45,10 +53,13 @@ async function getTcoHistoryChallengesDone(url, competitor) { challenges: _.filter(jsonResponse, challenge => ( challenge['member_profile_basic.user_id'] ? (challenge['member_profile_basic.user_id'] === competitor['member_profile_basic.user_id']) - : (challenge.userid === competitor.userid) + : (challenge.userid === (competitor['member_profile_basic.user_id'] || competitor.userid)) )), })); - return res; + return { + url, + challenges: res.challenges, + }; } export default createActions({ diff --git a/src/shared/components/Leaderboard/ChallengeHistoryModal/index.jsx b/src/shared/components/Leaderboard/ChallengeHistoryModal/index.jsx index f9e83ed626..2110e1fc1f 100644 --- a/src/shared/components/Leaderboard/ChallengeHistoryModal/index.jsx +++ b/src/shared/components/Leaderboard/ChallengeHistoryModal/index.jsx @@ -114,7 +114,7 @@ class ChallengeHistoryModal extends Component { { challengesOrdered.map(challenge => ( - + {challenge.challenge_name || challenge['challenge.challenge_name'] || challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id} @@ -136,6 +136,11 @@ class ChallengeHistoryModal extends Component { { loading ? : null } + { + !challengesOrdered.length && !loading && ( +
No data available.
+ ) + }