From 97c978dc7c364de215955b11b3a94a50aface996 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Sun, 29 Mar 2015 18:13:04 -0700 Subject: [PATCH] Make Basejumps show up properly and get their github routes persisting in the database. --- controllers/courseware.js | 21 ++++++++++++++++---- seed_data/coursewares.json | 4 ++-- views/coursewares/showZiplineOrBasejump.jade | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/controllers/courseware.js b/controllers/courseware.js index 82987ea7a7..ec22472bed 100644 --- a/controllers/courseware.js +++ b/controllers/courseware.js @@ -151,7 +151,22 @@ exports.returnIndividualCourseware = function(req, res, next) { coursewareHash: courseware._id, challengeType: courseware.challengeType }); - } + }, + + 4: function() { + res.render('coursewares/showZiplineOrBasejump', { + title: courseware.name, + dashedName: dashedName, + name: courseware.name, + details: courseware.description, + video: courseware.challengeSeed[0], + verb: resources.randomVerb(), + phrase: resources.randomPhrase(), + compliment: resources.randomCompliment(), + coursewareHash: courseware._id, + challengeType: courseware.challengeType + }); + } }; return challengeType[courseware.challengeType](); @@ -262,7 +277,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) { var isCompletedDate = Math.round(+new Date()); var coursewareHash = req.body.coursewareInfo.coursewareHash; var solutionLink = req.body.coursewareInfo.publicURL; - var githubLink = req.body.coursewareInfo.challengeType === 4 + var githubLink = req.body.coursewareInfo.challengeType === '4' ? req.body.coursewareInfo.githubURL : true; if (!solutionLink || !githubLink) { req.flash('errors', { @@ -285,8 +300,6 @@ exports.completedZiplineOrBasejump = function (req, res, next) { } pairedWith = pairedWith.pop(); - - req.user.completedCoursewares.push({ _id: coursewareHash, completedWith: pairedWith._id, diff --git a/seed_data/coursewares.json b/seed_data/coursewares.json index 5c92aa249c..6364c3f6a4 100644 --- a/seed_data/coursewares.json +++ b/seed_data/coursewares.json @@ -789,7 +789,7 @@ "Once it has loaded, install all of MEAN.js's packages by clicking into Cloud 9's terminal at the bottom and running npm install.", "Once that command has finished, set up MongoDB and start it by copying and pasting this code into Cloud 9's terminal: mkdir data && echo 'mongod --bind_ip=$IP --dbpath=data --nojournal --rest \"$@\"' > mongod && chmod a+x mongod && ./mongod. You don't worry if you don't understand what that means. From now on, you'll just need to run this command to start MongoDB: ./mongod." ], - "challengeType": 3, + "challengeType": 4, "tests": [] }, { @@ -3614,4 +3614,4 @@ ], "challengeType": 1 } -] \ No newline at end of file +] diff --git a/views/coursewares/showZiplineOrBasejump.jade b/views/coursewares/showZiplineOrBasejump.jade index d547ab3019..ed54ecb721 100644 --- a/views/coursewares/showZiplineOrBasejump.jade +++ b/views/coursewares/showZiplineOrBasejump.jade @@ -57,7 +57,7 @@ block content if (user) a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid && existingUser.length > 0') Go to my next challenge (ctrl + enter) - + - if (user.progressTimestamps.length > 2) a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank") i.fa.fa-twitter