Fix challenge map display for loopback updated models. Update loopback migration script to auto complete and catch all records.

This commit is contained in:
terakilobyte
2015-06-15 20:53:43 -04:00
parent 3d8b8e4c73
commit 4fa1f25cc2
4 changed files with 26 additions and 24 deletions

View File

@@ -29,7 +29,7 @@ module.exports = function(app) {
var completedChallengeList = noDuplicatedChallenges
.map(function(challenge) {
return challenge.id;
return (challenge.id || challenge._id); // backwards compatibility
});
var challengeList = utils.
getChallengeMapForDisplay(completedChallengeList);
@@ -37,7 +37,8 @@ module.exports = function(app) {
Object.keys(challengeList).forEach(function(key) {
challengeList[key].completed = challengeList[key]
.challenges.filter(function(elem) {
return completedChallengeList.indexOf(elem.id) > -1;
return completedChallengeList.indexOf(elem.id || elem._id) > -1;
//backwards compatibility hack
});
});