wire in points for courseware and bonfire
This commit is contained in:
@ -225,15 +225,17 @@ exports.completedBonfire = function (req, res) {
|
|||||||
return err;
|
return err;
|
||||||
} else {
|
} else {
|
||||||
var index = req.user.uncompletedBonfires.indexOf(bonfireHash);
|
var index = req.user.uncompletedBonfires.indexOf(bonfireHash);
|
||||||
|
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
|
req.user.points++;
|
||||||
req.user.uncompletedBonfires.splice(index, 1)
|
req.user.uncompletedBonfires.splice(index, 1)
|
||||||
}
|
}
|
||||||
pairedWith = pairedWith.pop();
|
pairedWith = pairedWith.pop();
|
||||||
|
|
||||||
index = pairedWith.uncompletedBonfires.indexOf(bonfireHash);
|
index = pairedWith.uncompletedBonfires.indexOf(bonfireHash);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
pairedWith.uncompletedBonfires.splice(index, 1)
|
pairedWith.points++;
|
||||||
|
pairedWith.uncompletedBonfires.splice(index, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pairedWith.completedBonfires.push({
|
pairedWith.completedBonfires.push({
|
||||||
@ -241,7 +243,7 @@ exports.completedBonfire = function (req, res) {
|
|||||||
completedWith: req.user._id,
|
completedWith: req.user._id,
|
||||||
completedDate: isCompletedDate,
|
completedDate: isCompletedDate,
|
||||||
solution: isSolution
|
solution: isSolution
|
||||||
})
|
});
|
||||||
|
|
||||||
req.user.completedBonfires.push({
|
req.user.completedBonfires.push({
|
||||||
_id: bonfireHash,
|
_id: bonfireHash,
|
||||||
@ -273,6 +275,7 @@ exports.completedBonfire = function (req, res) {
|
|||||||
|
|
||||||
var index = req.user.uncompletedBonfires.indexOf(bonfireHash);
|
var index = req.user.uncompletedBonfires.indexOf(bonfireHash);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
|
req.user.points++;
|
||||||
req.user.uncompletedBonfires.splice(index, 1)
|
req.user.uncompletedBonfires.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,6 +161,7 @@ exports.completedCourseware = function (req, res) {
|
|||||||
|
|
||||||
var index = req.user.uncompletedCoursewares.indexOf(coursewareHash);
|
var index = req.user.uncompletedCoursewares.indexOf(coursewareHash);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
|
req.user.points++;
|
||||||
req.user.uncompletedCoursewares.splice(index, 1)
|
req.user.uncompletedCoursewares.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"_id" : "ad7123c8c441eddfaeb5bdef",
|
"_id" : "ad7123c8c441eddfaeb5bdef",
|
||||||
"name": "Meet Bonfire!",
|
"name": "Meet Bonfire",
|
||||||
"difficulty": "0",
|
"difficulty": "0",
|
||||||
"description": [
|
"description": [
|
||||||
"Click the button below for further instructions.",
|
"Click the button below for further instructions.",
|
||||||
|
Reference in New Issue
Block a user