Update challengeMap display, more consistent dasherization

This commit is contained in:
terakilobyte
2015-05-25 16:02:25 -04:00
parent f9386d1291
commit fb3447c366
6 changed files with 54 additions and 29 deletions

View File

@@ -28,7 +28,7 @@ var async = require('async'),
* Cached values
*/
var allFieldGuideIds, allFieldGuideNames, allNonprofitNames,
challengeMap, challengeMapWithIds,
challengeMap, challengeMapForDisplay, challengeMapWithIds,
challengeMapWithNames, allChallengeIds, allChallenges;
/**
@@ -67,13 +67,24 @@ Array.zip = function(left, right, combinerFunction) {
});
challengeMap = _.cloneDeep(localChallengeMap);
}
//todo remove this debug
debug(challengeMap);
})();
module.exports = {
getChallengeMapForDisplay: function() {
if (!challengeMapForDisplay) {
challengeMapForDisplay = {};
Object.keys(challengeMap).forEach(function(key) {
challengeMapForDisplay[key] = {
name: challengeMap[key].name,
challenges: challengeMap[key].challenges
}
});
}
return challengeMapForDisplay;
},
getChallengeMapWithIds: function() {
if (!challengeMapWithIds) {
challengeMapWithIds = {};