Changes to courseware and bonfire controller to handle direction to next challenge if the user has completed all offerings, also show a flash message letting them know why they are being redirected

This commit is contained in:
Nathan Leniz
2015-02-04 23:27:57 -05:00
parent adfe5588d6
commit 5898de7ab9
2 changed files with 17 additions and 4 deletions

View File

@@ -59,8 +59,14 @@ exports.returnNextBonfire = function(req, res) {
next(err);
}
bonfire = bonfire.pop();
if (bonfire === undefined) {
req.flash('errors', {
msg: "It looks like you've completed all the bonfires we have available. Good job!"
})
return res.redirect('../bonfires/meet-bonfire');
}
nameString = bonfire.name.toLowerCase().replace(/\s/g, '-');
return res.redirect('/bonfires/' + nameString);
return res.redirect('../bonfires/' + nameString);
});
};