Fix display of zipline/basejump completion in account view for new solutions.
This commit is contained in:
@ -457,6 +457,8 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
|
|||||||
var solutionLink = req.body.challengeInfo.publicURL;
|
var solutionLink = req.body.challengeInfo.publicURL;
|
||||||
var githubLink = req.body.challengeInfo.challengeType === '4'
|
var githubLink = req.body.challengeInfo.challengeType === '4'
|
||||||
? req.body.challengeInfo.githubURL : true;
|
? req.body.challengeInfo.githubURL : true;
|
||||||
|
var challengeType = req.body.challengeInfo.challengeType === '4' ?
|
||||||
|
4 : 3;
|
||||||
if (!solutionLink || !githubLink) {
|
if (!solutionLink || !githubLink) {
|
||||||
req.flash('errors', {
|
req.flash('errors', {
|
||||||
msg: 'You haven\'t supplied the necessary URLs for us to inspect ' +
|
msg: 'You haven\'t supplied the necessary URLs for us to inspect ' +
|
||||||
@ -487,6 +489,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
|
|||||||
completedDate: isCompletedDate,
|
completedDate: isCompletedDate,
|
||||||
solution: solutionLink,
|
solution: solutionLink,
|
||||||
githubLink: githubLink,
|
githubLink: githubLink,
|
||||||
|
challengeType: challengeType,
|
||||||
verified: false
|
verified: false
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -512,6 +515,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
|
|||||||
completedDate: isCompletedDate,
|
completedDate: isCompletedDate,
|
||||||
solution: solutionLink,
|
solution: solutionLink,
|
||||||
githubLink: githubLink,
|
githubLink: githubLink,
|
||||||
|
challengeType: challengeType,
|
||||||
verified: false
|
verified: false
|
||||||
});
|
});
|
||||||
pairedWith.save(function (err, paired) {
|
pairedWith.save(function (err, paired) {
|
||||||
@ -534,6 +538,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
|
|||||||
completedDate: isCompletedDate,
|
completedDate: isCompletedDate,
|
||||||
solution: solutionLink,
|
solution: solutionLink,
|
||||||
githubLink: githubLink,
|
githubLink: githubLink,
|
||||||
|
challengeType: challengeType,
|
||||||
verified: false
|
verified: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -398,8 +398,8 @@ exports.returnUser = function(req, res, next) {
|
|||||||
|
|
||||||
user.currentStreak = user.currentStreak || 1;
|
user.currentStreak = user.currentStreak || 1;
|
||||||
user.longestStreak = user.longestStreak || 1;
|
user.longestStreak = user.longestStreak || 1;
|
||||||
var challenges = user.completedCoursewares.filter(function ( obj ) {
|
var challenges = user.completedChallenges.filter(function ( obj ) {
|
||||||
return !!obj.solution;
|
return obj.challengeType === 3 || obj.challengeType === 4;
|
||||||
});
|
});
|
||||||
|
|
||||||
res.render('account/show', {
|
res.render('account/show', {
|
||||||
|
Reference in New Issue
Block a user