start refactoring next challenge logic

This commit is contained in:
Quincy Larson
2015-09-08 21:45:53 -07:00
parent 1e82165ed2
commit f0a4924671
4 changed files with 7 additions and 11 deletions

View File

@ -457,7 +457,7 @@ function showCompletion() {
},
function(res) {
if (res) {
window.location = '/challenges/next-challenge';
window.location = '/challenges/next-challenge?id=' + challenge_Id;
}
}
);

View File

@ -141,7 +141,7 @@ $(document).ready(function() {
}).success(
function(res) {
if (res) {
window.location.href = '/challenges/next-challenge';
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
}
}).fail(
function() {
@ -164,7 +164,7 @@ $(document).ready(function() {
}
}).success(
function() {
window.location.href = '/challenges/next-challenge';
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
}).fail(
function() {
window.location.href = '/challenges';
@ -187,13 +187,13 @@ $(document).ready(function() {
verified: false
}
}).success(function() {
window.location.href = '/challenges/next-challenge';
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
}).fail(function() {
window.location.replace(window.location.href);
});
break;
case challengeTypes.BONFIRE:
window.location.href = '/challenges/next-challenge';
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
default:
break;
}

View File

@ -142,9 +142,7 @@ module.exports = function(app) {
function returnNextChallenge(req, res, next) {
let nextChallengeName = firstChallenge;
const challengeId = req.user.currentChallenge ?
req.user.currentChallenge.challengeId :
'bd7123c8c441eddfaeb5bdef';
const challengeId = req.query.id;
// find challenge
return challenge$
@ -199,9 +197,6 @@ module.exports = function(app) {
nextChallengeName = nextChallenge.dashedName;
return nextChallengeName;
})
.flatMap(() => {
return saveUser(req.user);
})
.subscribe(
function() {},
next,

View File

@ -47,3 +47,4 @@
h3 This will restore your code editor to its original state.
a.btn.btn-lg.btn-info.btn-block#reset-button(href='#', data-dismiss='modal', aria-hidden='true') Clear my code
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
script.