diff --git a/controllers/fieldGuide.js b/controllers/fieldGuide.js index 51f01e8529c..a7d00fc97b6 100644 --- a/controllers/fieldGuide.js +++ b/controllers/fieldGuide.js @@ -9,6 +9,16 @@ exports.returnIndividualFieldGuide = function(req, res, next) { var fieldGuideName = dashedName.replace(/\-/g, ' '); + var completed = req.user.completedFieldGuides; + + var uncompletedFieldGuides = resources.allFieldGuideIds().filter(function (elem) { + if (completed.indexOf(elem) === -1) { + return elem; + } + }); + req.user.uncompletedFieldGuides = uncompletedFieldGuides; + req.user.save(); + FieldGuide.find({'name': new RegExp(fieldGuideName, 'i')}, function(err, fieldGuideFromMongo) { if (err) { next(err); @@ -52,26 +62,18 @@ exports.returnNextFieldGuide = function(req, res, next) { return res.redirect('../field-guide/how-do-i-use-this-guide?'); } - var completed = req.user.completedFieldGuides; - - var uncompletedFieldGuides = resources.allFieldGuideIds().filter(function (elem) { - if (completed.indexOf(elem) === -1) { - return elem; - } - }); - req.user.uncompletedFieldGuides = uncompletedFieldGuides; - req.user.save(); - - var displayedFieldGuides = FieldGuide.find({'_id': uncompletedFieldGuides[0]}); + var displayedFieldGuides = FieldGuide.find({'_id': req.user.uncompletedFieldGuides[0]}); displayedFieldGuides.exec(function(err, fieldGuide) { if (err) { return next(err); } fieldGuide = fieldGuide.pop(); if (typeof fieldGuide === 'undefined') { - req.flash('success', { - msg: "You've read all our current Field Guide entries. You can contribute to our Field Guide here." - }); + if (req.user.completedFieldGuides.length > 0) { + req.flash('success', { + msg: "You've read all our current Field Guide entries. You can contribute to our Field Guide here." + }); + } return res.redirect('../field-guide/how-do-i-use-this-guide?'); } var nameString = fieldGuide.name.toLowerCase().replace(/\s/g, '-'); diff --git a/seed_data/coursewares.json b/seed_data/coursewares.json index 3ad688a901c..27831c49568 100644 --- a/seed_data/coursewares.json +++ b/seed_data/coursewares.json @@ -68,7 +68,7 @@ }, { "_id": "bd7125d8c441eddfaeb5bd2f", - "name": "Customize your Porfolio Page", + "name": "Customize your Portfolio Page", "difficulty": 0.05, "challengeSeed": "125407433", "description": [ @@ -102,6 +102,24 @@ "challengeType": 2, "tests": [] }, + { + "_id": "bd7126d8c441eddfaeb5bd3e", + "name": "Meet Other Campers in your City", + "difficulty": 0.065, + "challengeSeed": "127358841", + "description": [ + "One of the best ways to stay motivated when learning to code is to hang out with other campers.", + "Slack and Camper News are great ways to communicate with other campers, but there's no substitute for meeting people in-person.", + "The easiest way to meet other campers in your city is to join your city's Facebook Group. Click here to view our growing list of local groups.", + "Click the link to your city, then, once Facebook loads, click \"Join group\".", + "Our local groups are new, so if you don't see your city on this list, you should follow the directions to create a Facebook group for your city.", + "If you don't have a Facebook account, we strongly recommend you create one, even if it's just for the purpose of coordinating with campers in your city through this group.", + "Our groups allow you to create events, coordinate those events, and share photos from the events afterward.", + "Whether you're hosting a study group, pair programming at your local library, or going to a weekend hackathon, your city's group will help you make it happen." + ], + "challengeType": 2, + "tests": [] + }, { "_id": "bd7137d8c441eddfaeb5bdef", "name": "Get Help the Hacker Way with RSAP", diff --git a/seed_data/field-guides.json b/seed_data/field-guides.json index 0545caaefbc..7685dc457e2 100644 --- a/seed_data/field-guides.json +++ b/seed_data/field-guides.json @@ -282,10 +282,15 @@ "