Fixed routing for unfound coursewares

This commit is contained in:
Nathan Leniz
2015-02-06 14:28:28 -05:00
parent 26417c5483
commit 0313fd9751

View File

@ -57,8 +57,6 @@ exports.returnIndividualCourseware = function(req, res, next) {
if (err) {
next(err);
}
courseware = courseware.pop();
// Handle not found
if (courseware.length < 1) {
req.flash('errors', {
@ -66,6 +64,7 @@ exports.returnIndividualCourseware = function(req, res, next) {
});
return res.redirect('/coursewares')
}
courseware = courseware.pop();
// Redirect to full name if the user only entered a partial
var dashedNameFull = courseware.name.toLowerCase().replace(/\s/g, '-');