reached a stopping point, trying to fix a production bug

This commit is contained in:
Michael Q Larson
2014-11-26 22:00:28 -08:00
parent 645f363fc3
commit 456c845967
3 changed files with 17 additions and 21 deletions

View File

@@ -6,7 +6,8 @@
exports.index = function(req, res) {
if (req.user) {
if (req.user.challengesCompleted.length > 0) {
nextChallenge = Math.max.apply(Math, req.user.challengesCompleted) + 1;
Object.values(req.user.challengesHash);
nextChallenge = Math.max.apply(Math, req.user.challengesHash) + 1;
res.redirect("challenges/" + nextChallenge);
} else {
res.redirect("challenges/0");