start refactoring next challenge logic
This commit is contained in:
@ -457,7 +457,7 @@ function showCompletion() {
|
||||
},
|
||||
function(res) {
|
||||
if (res) {
|
||||
window.location = '/challenges/next-challenge';
|
||||
window.location = '/challenges/next-challenge?id=' + challenge_Id;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user