wire in points for courseware and bonfire

This commit is contained in:
Michael Q Larson
2015-02-04 19:39:57 -08:00
parent 98286e19d1
commit adfe5588d6
3 changed files with 8 additions and 4 deletions

View File

@ -225,15 +225,17 @@ exports.completedBonfire = function (req, res) {
return err;
} else {
var index = req.user.uncompletedBonfires.indexOf(bonfireHash);
if (index > -1) {
req.user.points++;
req.user.uncompletedBonfires.splice(index, 1)
}
pairedWith = pairedWith.pop();
index = pairedWith.uncompletedBonfires.indexOf(bonfireHash);
if (index > -1) {
pairedWith.uncompletedBonfires.splice(index, 1)
pairedWith.points++;
pairedWith.uncompletedBonfires.splice(index, 1);
}
pairedWith.completedBonfires.push({
@ -241,7 +243,7 @@ exports.completedBonfire = function (req, res) {
completedWith: req.user._id,
completedDate: isCompletedDate,
solution: isSolution
})
});
req.user.completedBonfires.push({
_id: bonfireHash,
@ -273,6 +275,7 @@ exports.completedBonfire = function (req, res) {
var index = req.user.uncompletedBonfires.indexOf(bonfireHash);
if (index > -1) {
req.user.points++;
req.user.uncompletedBonfires.splice(index, 1)
}

View File

@ -161,6 +161,7 @@ exports.completedCourseware = function (req, res) {
var index = req.user.uncompletedCoursewares.indexOf(coursewareHash);
if (index > -1) {
req.user.points++;
req.user.uncompletedCoursewares.splice(index, 1)
}

View File

@ -1,7 +1,7 @@
[
{
"_id" : "ad7123c8c441eddfaeb5bdef",
"name": "Meet Bonfire!",
"name": "Meet Bonfire",
"difficulty": "0",
"description": [
"Click the button below for further instructions.",