start refactoring next challenge logic
This commit is contained in:
@ -457,7 +457,7 @@ function showCompletion() {
|
|||||||
},
|
},
|
||||||
function(res) {
|
function(res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
window.location = '/challenges/next-challenge';
|
window.location = '/challenges/next-challenge?id=' + challenge_Id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -141,7 +141,7 @@ $(document).ready(function() {
|
|||||||
}).success(
|
}).success(
|
||||||
function(res) {
|
function(res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
window.location.href = '/challenges/next-challenge';
|
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||||
}
|
}
|
||||||
}).fail(
|
}).fail(
|
||||||
function() {
|
function() {
|
||||||
@ -164,7 +164,7 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
}).success(
|
}).success(
|
||||||
function() {
|
function() {
|
||||||
window.location.href = '/challenges/next-challenge';
|
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||||
}).fail(
|
}).fail(
|
||||||
function() {
|
function() {
|
||||||
window.location.href = '/challenges';
|
window.location.href = '/challenges';
|
||||||
@ -187,13 +187,13 @@ $(document).ready(function() {
|
|||||||
verified: false
|
verified: false
|
||||||
}
|
}
|
||||||
}).success(function() {
|
}).success(function() {
|
||||||
window.location.href = '/challenges/next-challenge';
|
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
window.location.replace(window.location.href);
|
window.location.replace(window.location.href);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case challengeTypes.BONFIRE:
|
case challengeTypes.BONFIRE:
|
||||||
window.location.href = '/challenges/next-challenge';
|
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -142,9 +142,7 @@ module.exports = function(app) {
|
|||||||
function returnNextChallenge(req, res, next) {
|
function returnNextChallenge(req, res, next) {
|
||||||
let nextChallengeName = firstChallenge;
|
let nextChallengeName = firstChallenge;
|
||||||
|
|
||||||
const challengeId = req.user.currentChallenge ?
|
const challengeId = req.query.id;
|
||||||
req.user.currentChallenge.challengeId :
|
|
||||||
'bd7123c8c441eddfaeb5bdef';
|
|
||||||
|
|
||||||
// find challenge
|
// find challenge
|
||||||
return challenge$
|
return challenge$
|
||||||
@ -199,9 +197,6 @@ module.exports = function(app) {
|
|||||||
nextChallengeName = nextChallenge.dashedName;
|
nextChallengeName = nextChallenge.dashedName;
|
||||||
return nextChallengeName;
|
return nextChallengeName;
|
||||||
})
|
})
|
||||||
.flatMap(() => {
|
|
||||||
return saveUser(req.user);
|
|
||||||
})
|
|
||||||
.subscribe(
|
.subscribe(
|
||||||
function() {},
|
function() {},
|
||||||
next,
|
next,
|
||||||
|
@ -47,3 +47,4 @@
|
|||||||
h3 This will restore your code editor to its original state.
|
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-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
|
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||||
|
script.
|
||||||
|
Reference in New Issue
Block a user