challenges are working when authenticated
This commit is contained in:
3
app.js
3
app.js
@ -538,7 +538,8 @@ app.post('/completed-field-guide/', fieldGuideController.completedFieldGuide);
|
||||
|
||||
app.get('/challenges/next-challenge',
|
||||
userController.userMigration,
|
||||
challengeController.returnNextChallenge);
|
||||
challengeController.returnNextChallenge
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/challenges/:challengeName',
|
||||
|
@ -40,7 +40,6 @@ module.exports = {
|
||||
|
||||
User.count({}, function (err, camperCount) {
|
||||
if (err) {
|
||||
debug('User err: ', err);
|
||||
return next(err);
|
||||
}
|
||||
res.render('challengeMap/show', {
|
||||
|
@ -22,16 +22,11 @@ var _ = require('lodash'),
|
||||
*/
|
||||
exports.userMigration = function(req, res, next) {
|
||||
if (req.user && req.user.completedChallenges.length === 0) {
|
||||
debug('user migration called');
|
||||
debug('Completed coursewares', req.user.completedCoursewares);
|
||||
debug('Completed bonfires', req.user.completedBonfires);
|
||||
req.user.completedChallenges = R.filter(function (elem) {
|
||||
return elem; // getting rid of undefined
|
||||
}, R.concat(
|
||||
req.user.completedCoursewares,
|
||||
req.user.completedBonfires.map(function (bonfire) {
|
||||
debug('Completed coursewares', req.user.completedCoursewares);
|
||||
debug('Completed bonfires', req.user.completedBonfires);
|
||||
return ({
|
||||
completedDate: bonfire.completedDate,
|
||||
_id: bonfire._id,
|
||||
@ -44,7 +39,6 @@ exports.userMigration = function(req, res, next) {
|
||||
});
|
||||
})
|
||||
));
|
||||
debug(req.user.completedChallenges);
|
||||
next();
|
||||
} else {
|
||||
next();
|
||||
@ -378,7 +372,6 @@ exports.returnUser = function(req, res, next) {
|
||||
moment(timeKeys[_i]).toString()
|
||||
) {
|
||||
|
||||
debug(timeKeys[_i - 1], timeKeys[_i]);
|
||||
tmpLongest++;
|
||||
|
||||
if (tmpLongest > user.currentStreak) {
|
||||
|
@ -16,8 +16,7 @@
|
||||
"If you've spent several minutes on one of these challenges, and still can't figure out its correct answer, you can click \"show answer\", then click \"run\" to advance to the next challenge. Be sure to read the correct answer and make sure you understand it before moving on."
|
||||
],
|
||||
"challengeType": 2,
|
||||
"tests": [],
|
||||
"challengeType": 0
|
||||
"tests": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -15,7 +15,8 @@
|
||||
"You can save your progress by creating a free Udacity account, but note that it's also possible to complete this entire course without an account by following the links we provide.",
|
||||
"Go to <a href='https://www.udacity.com/course/viewer#!/c-ud015/l-2593668697/m-2541189051'>https://www.udacity.com/course/viewer#!/c-ud015/l-2593668697/m-2541189051</a> and start the course.",
|
||||
"Once you've completed this first section of scopes, mark this Waypoint complete and move on to the next one."
|
||||
]
|
||||
],
|
||||
"challengeType": 2
|
||||
},
|
||||
{
|
||||
"_id": "bd7131d8c441eddfaeb5bdbf",
|
||||
@ -31,8 +32,7 @@
|
||||
"Once you've completed this section of using the keyword \"this\", mark this Waypoint complete and move on to the next one."
|
||||
],
|
||||
"challengeType": 2,
|
||||
"tests": [],
|
||||
"challengeType": 0
|
||||
"tests": []
|
||||
},
|
||||
{
|
||||
"_id": "bd7132d8c441eddfaeb5bdaf",
|
||||
@ -47,8 +47,7 @@
|
||||
"Once you've completed this section on prototype chain traversal, mark this Waypoint complete and move on to the next one."
|
||||
],
|
||||
"challengeType": 2,
|
||||
"tests": [],
|
||||
"challengeType": 0
|
||||
"tests": []
|
||||
},
|
||||
{
|
||||
"_id": "bd7133d8c441eddfaeb5bd0f",
|
||||
@ -64,8 +63,7 @@
|
||||
"Once you've completed this section of decorators, mark this Waypoint complete and move on to the next one."
|
||||
],
|
||||
"challengeType": 2,
|
||||
"tests": [],
|
||||
"challengeType": 0
|
||||
"tests": []
|
||||
},
|
||||
{
|
||||
"_id": "bd7134d8c441eddfaeb5bd1f",
|
||||
@ -80,8 +78,7 @@
|
||||
"Once you've completed this section of functional classes, mark this Waypoint complete and move on to the next one."
|
||||
],
|
||||
"challengeType": 2,
|
||||
"tests": [],
|
||||
"challengeType": 0
|
||||
"tests": []
|
||||
},
|
||||
{
|
||||
"_id": "bd7135d8c441eddfaeb5bd2f",
|
||||
@ -97,8 +94,7 @@
|
||||
"Once you've completed this section of prototypal classes, mark this Waypoint complete and move on to the next one."
|
||||
],
|
||||
"challengeType": 2,
|
||||
"tests": [],
|
||||
"challengeType": 0
|
||||
"tests": []
|
||||
},
|
||||
{
|
||||
"_id": "bd7136d8c441eddfaeb5bd3f",
|
||||
@ -114,8 +110,7 @@
|
||||
"Once you've completed this section pseudoclasses, mark this Waypoint complete and move on to the next one."
|
||||
],
|
||||
"challengeType": 2,
|
||||
"tests": [],
|
||||
"challengeType": 0
|
||||
"tests": []
|
||||
},
|
||||
{
|
||||
"_id": "bd7136d8c441eddfaeb5bd4f",
|
||||
@ -130,8 +125,7 @@
|
||||
"Once you've completed this section on subclassing, mark this Waypoint complete and move on to the next one."
|
||||
],
|
||||
"challengeType": 2,
|
||||
"tests": [],
|
||||
"challengeType": 0
|
||||
"tests": []
|
||||
},
|
||||
{
|
||||
"_id": "bd7136d8c441eddfaeb5bd5f",
|
||||
@ -145,8 +139,7 @@
|
||||
"Once you've completed this final section on pseudoclassical subclassing, mark this Waypoint complete and move on."
|
||||
],
|
||||
"challengeType": 2,
|
||||
"tests": [],
|
||||
"challengeType": 0
|
||||
"tests": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -82,12 +82,11 @@ block content
|
||||
if (user)
|
||||
form.form-horizontal(novalidate='novalidate', name='completedWithForm')
|
||||
.form-group.text-center
|
||||
.col-xs-10.col-xs-offset-1.col-sm-8.col-sm-offset-2.col-md-8.col-md-offset-2.animated.fadeIn
|
||||
.col-xs-12
|
||||
// extra field to distract password tools like lastpass from injecting css into our username field
|
||||
input.form-control(ng-show="false")
|
||||
label(for="existingUser") If you're pairing with someone, enter their FreeCodeCamp username here
|
||||
input.form-control#completed-with(name="existingUser", placeholder="Pair Username", existing-username='', ng-model="existingUser", autofocus)
|
||||
.col-xs-10.col-xs-offset-1.col-sm-8.col-sm-offset-2.col-md-8.col-md-offset-2(ng-cloak, ng-show="completedWithForm.$error.exists && !completedWithForm.existingUser.$pristine && existingUser.length > 0")
|
||||
input.form-control#completed-with(name="existingUser", placeholder="Your pair's username if pairing", existing-username='', ng-model="existingUser")
|
||||
.col-xs-12(ng-cloak, ng-show="completedWithForm.$error.exists && !completedWithForm.existingUser.$pristine && existingUser.length > 0")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
| Username not found
|
||||
|
Reference in New Issue
Block a user