From 1aa759ee1807d0bc6ef5855e1ed6176209018f54 Mon Sep 17 00:00:00 2001 From: Frederic Lavigne Date: Wed, 21 Jun 2017 10:26:12 +0200 Subject: [PATCH] added "rewards" field to new challenge form updated seed data with sample rewards #60 --- routes/account/workouts.js | 1 - routes/market.js | 1 - seed/market.json | 15 +++++++++----- ui-react/src/Organization/NewChallenge.js | 24 +++++++++++++++++++++-- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/routes/account/workouts.js b/routes/account/workouts.js index afef716..1fdb3c0 100644 --- a/routes/account/workouts.js +++ b/routes/account/workouts.js @@ -24,7 +24,6 @@ router.get('/', checkAuthenticated, (req, res) => { if (err) { res.status(500).send({ ok: false }); } else { - // console.log('Retrieved', result); res.send(result.docs); } }); diff --git a/routes/market.js b/routes/market.js index 14de880..5475353 100644 --- a/routes/market.js +++ b/routes/market.js @@ -44,7 +44,6 @@ router.get('/organization/challenges', checkAuthenticated, (req, res) => { if (err) { res.status(500).send({ ok: false }); } else { - // console.log('Retrieved', result); res.send(result.docs); } }); diff --git a/seed/market.json b/seed/market.json index fedd1ba..533de03 100644 --- a/seed/market.json +++ b/seed/market.json @@ -9,7 +9,8 @@ "goal": 10, "unit": "workout", "activity": "CYCLING", - "description": "Earn a water bottle for 10 bike commutes to work" + "description": "Earn a water bottle for 10 bike commutes to work", + "rewards": 1000 }, { "_id": "fitForWork", @@ -21,7 +22,8 @@ "goal": 30, "unit": "workout", "activity": "ANY", - "description": "$100 health insurance credit for 30 workouts a year" + "description": "$100 health insurance credit for 30 workouts a year", + "rewards": 100 }, { "_id": "stairChallenge", @@ -33,7 +35,8 @@ "goal": 1000, "unit": "workout", "activity": "STAIRS", - "description": "Bobble hat for 1000 stairs climbed this winter" + "description": "Bobble hat for 1000 stairs climbed this winter", + "rewards": 1000 }, { "_id": "runnersLifeInsurance", @@ -45,7 +48,8 @@ "goal": 20, "unit": "workout", "activity": "RUNNING", - "description": "20% discount for 20 runs a year" + "description": "20% discount for 20 runs a year", + "rewards": 750 }, { "_id": "marathonQualifying", @@ -57,6 +61,7 @@ "goal": 1, "unit": "workout", "activity": "RUNNING", - "description": "Run one marathon in less than 4 hours" + "description": "Run one marathon in less than 4 hours", + "rewards": 500 } ] diff --git a/ui-react/src/Organization/NewChallenge.js b/ui-react/src/Organization/NewChallenge.js index b79cc04..701570f 100644 --- a/ui-react/src/Organization/NewChallenge.js +++ b/ui-react/src/Organization/NewChallenge.js @@ -17,7 +17,8 @@ class NewChallenge extends Component { goal: 1, unit: 'workout', activity: 'RUNNING', - description: 'Run one marathon in less than 4 hours' + description: 'Run one marathon in less than 4 hours', + rewards: 100 }; this.handleInputChange = this.handleInputChange.bind(this); this.submitNewChallenge = this.submitNewChallenge.bind(this); @@ -105,16 +106,35 @@ class NewChallenge extends Component { onChange={this.handleInputChange} /> - + +

+ Number of Workouts +

+ + +

+ Reward tokens in the system +

+ +
+