Undefined check on homepage, update updateCourses.js

This commit is contained in:
Matt Lott 2016-08-18 16:52:45 -07:00
parent dc7c220b57
commit d6d208803c
2 changed files with 6 additions and 2 deletions

View file

@ -242,7 +242,7 @@ block content
h6.course-name= i18n(course.attributes, 'name') + ':'
p.small
- var total = 0;
each concept in course.get('concepts')
each concept in course.get('concepts') || []
- if (conceptsSeen[concept]) continue;
- conceptsSeen[concept] = true;
if total === 3

View file

@ -123,7 +123,11 @@ _.forEach(courses, function(course) {
print("Updating courses..");
for (var i = 0; i < courses.length; i++) {
db.courses.update({slug: courses[i].slug}, {$set: courses[i]}, {upsert: true});
var result = db.courses.update({slug: courses[i].slug}, {$set: courses[i]});
if (result.nMatched !== 1) {
print("Failed to update " + courses[i].slug);
print(JSON.stringify(result, null, 2));
}
}
print("Upserting i18n", db.courses.update(