Fix(accounts): show challenge info on user profile

This changes the behavior of the user profile page to pull the current
challenge info from our challenge map and overwrite the user challenge.
This should also make name changes point to the correct challenge
regardless of the info saved to the user profile
This commit is contained in:
Berkeley Martinez
2016-08-01 16:54:33 -07:00
parent 7f22c59239
commit 606bfd7c88
6 changed files with 197 additions and 179 deletions

View File

@@ -0,0 +1,12 @@
// createNameIdMap(entities: Object) => Object
export default function createNameIdMap(entities) {
const { challenge } = entities;
return {
...entities,
challengeIdToName: Object.keys(challenge)
.reduce((map, challengeName) => {
map[challenge[challengeName].id] = challenge[challengeName].dashedName;
return map;
}, {})
};
}