fix(cert-settings): Uncouple Cert-Settings from dashedName's

This commit is contained in:
Stuart Taylor
2018-03-05 14:15:30 +00:00
parent 15473616c9
commit 6301411673
6 changed files with 148 additions and 192 deletions

View File

@@ -1,19 +1,14 @@
import { dasherize } from '../../../../../server/utils/index';
export const jsProjectSuperBlock = 'javascript-algorithms-and-data-structures';
export function buildUserProjectsMap(projectBlock, challengeMap) {
const {
challengeNameIdMap,
challenges,
superBlock
} = projectBlock;
return {
[superBlock]: challenges.reduce((solutions, current) => {
const dashedName = dasherize(current)
.replace('java-script', 'javascript')
.replace('metric-imperial', 'metricimperial');
const completed = challengeMap[challengeNameIdMap[dashedName]];
const { id } = current;
const completed = challengeMap[id];
let solution = '';
if (superBlock === jsProjectSuperBlock) {
solution = {};
@@ -25,7 +20,7 @@ export function buildUserProjectsMap(projectBlock, challengeMap) {
}
return {
...solutions,
[current]: solution
[current.title]: solution
};
}, {})
};