Fix challenge map display for loopback updated models. Update loopback migration script to auto complete and catch all records.
This commit is contained in:
@@ -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
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user