From 9b8a7cdd496c0aa8ef0d9ffd84289b8e6b237dcd Mon Sep 17 00:00:00 2001 From: terakilobyte Date: Tue, 26 May 2015 11:30:06 -0400 Subject: [PATCH] Fix display of zipline/basejump completion in account view for new solutions. --- controllers/challenge.js | 5 +++++ controllers/user.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/controllers/challenge.js b/controllers/challenge.js index 0ea90a4505..12a3c3655e 100644 --- a/controllers/challenge.js +++ b/controllers/challenge.js @@ -457,6 +457,8 @@ exports.completedZiplineOrBasejump = function (req, res, next) { var solutionLink = req.body.challengeInfo.publicURL; var githubLink = req.body.challengeInfo.challengeType === '4' ? req.body.challengeInfo.githubURL : true; + var challengeType = req.body.challengeInfo.challengeType === '4' ? + 4 : 3; if (!solutionLink || !githubLink) { req.flash('errors', { msg: 'You haven\'t supplied the necessary URLs for us to inspect ' + @@ -487,6 +489,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) { completedDate: isCompletedDate, solution: solutionLink, githubLink: githubLink, + challengeType: challengeType, verified: false }); @@ -512,6 +515,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) { completedDate: isCompletedDate, solution: solutionLink, githubLink: githubLink, + challengeType: challengeType, verified: false }); pairedWith.save(function (err, paired) { @@ -534,6 +538,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) { completedDate: isCompletedDate, solution: solutionLink, githubLink: githubLink, + challengeType: challengeType, verified: false }); diff --git a/controllers/user.js b/controllers/user.js index ab000593ce..f83ac9e0be 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -398,8 +398,8 @@ exports.returnUser = function(req, res, next) { user.currentStreak = user.currentStreak || 1; user.longestStreak = user.longestStreak || 1; - var challenges = user.completedCoursewares.filter(function ( obj ) { - return !!obj.solution; + var challenges = user.completedChallenges.filter(function ( obj ) { + return obj.challengeType === 3 || obj.challengeType === 4; }); res.render('account/show', {