Merge pull request #16789 from Bouncey/fix/profileChallenges

fix(profile): Fix challenges of undefined Error
This commit is contained in:
Berkeley Martinez
2018-02-28 09:05:30 -08:00
committed by GitHub
3 changed files with 18 additions and 7 deletions

View File

@ -110,14 +110,14 @@ export function projectsSelector(state) {
key.includes('projects') && !key.includes('coding-interview')
)
.map(key => blocks[key])
.map(({ name, challenges, superBlock }) => {
.map(({ title, challenges, superBlock }) => {
const projectChallengeDashNames = challenges
// remove any project intros
.filter(chal => !chal.includes('get-set-for'));
const projectChallenges = projectChallengeDashNames
.map(dashedName => selectiveChallengeTitleSelector(state, dashedName));
return {
projectBlockName: name,
projectBlockName: title,
superBlock,
challenges: projectChallenges,
challengeNameIdMap: pick(

View File

@ -68,7 +68,9 @@ export function fetchChallengesForBlockEpic(
.flatMapLatest(({ type, payload }) => {
const fetchAnotherBlock = type === types.fetchNewBlock.start;
const state = getState();
let { block: blockName } = challengeSelector(state);
let {
block: blockName = 'basic-html-and-html5'
} = challengeSelector(state);
const lang = langSelector(state);
if (fetchAnotherBlock) {

View File

@ -34,10 +34,19 @@ export default function mapUiService(app) {
}, {});
const blockMap = Object.keys(fullBlockMap)
.map(block => fullBlockMap[block])
.reduce((map, { dashedName, title, time, challenges }) => {
map[dashedName] = { dashedName, title, time, challenges };
return map;
}, {});
.reduce(
(map, { dashedName, title, time, challenges, superBlock }) => {
map[dashedName] = {
dashedName,
title,
time,
challenges,
superBlock
};
return map;
},
{}
);
const challengeMap = Object.keys(fullChallengeMap)
.map(challenge => fullChallengeMap[challenge])
.reduce((map, challenge) => {