From adfe5588d6096a4e8e2efc2a71746fbbc53c89bc Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Wed, 4 Feb 2015 19:39:57 -0800 Subject: [PATCH] wire in points for courseware and bonfire --- controllers/bonfire.js | 9 ++++++--- controllers/courseware.js | 1 + seed_data/bonfires.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/controllers/bonfire.js b/controllers/bonfire.js index 57949efd8d..95e1a56c1d 100644 --- a/controllers/bonfire.js +++ b/controllers/bonfire.js @@ -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) } diff --git a/controllers/courseware.js b/controllers/courseware.js index 76938d602b..1071182aa4 100644 --- a/controllers/courseware.js +++ b/controllers/courseware.js @@ -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) } diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 9fc3dacad9..cc594699e8 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -1,7 +1,7 @@ [ { "_id" : "ad7123c8c441eddfaeb5bdef", - "name": "Meet Bonfire!", + "name": "Meet Bonfire", "difficulty": "0", "description": [ "Click the button below for further instructions.",