Skip to content

Commit

Permalink
added "rewards" field to new challenge form
Browse files Browse the repository at this point in the history
updated seed data with sample rewards
#60
  • Loading branch information
Frederic Lavigne committed Jun 21, 2017
1 parent d8cdb58 commit 1aa759e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
1 change: 0 additions & 1 deletion routes/account/workouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down
1 change: 0 additions & 1 deletion routes/market.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down
15 changes: 10 additions & 5 deletions seed/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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
}
]
24 changes: 22 additions & 2 deletions ui-react/src/Organization/NewChallenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -105,16 +106,35 @@ class NewChallenge extends Component {
onChange={this.handleInputChange}
/>
</FormGroup>
<FormGroup className="some-class" legendText="Goal">

<FormGroup className="some-class" legendText="Goal">
<p>
Number of Workouts
</p>
<TextInput
className="some-class"
id="goal"
label="Number of Workouts"
type="number"
value={this.state.goal}
onChange={this.handleInputChange}
/>
</FormGroup>

<FormGroup className="some-class" legendText="Rewards">
<p>
Reward tokens in the system
</p>
<TextInput
className="some-class"
id="rewards"
label="Rewards"
type="number"
value={this.state.rewards}
onChange={this.handleInputChange}
/>
</FormGroup>

<Button onClick={this.submitNewChallenge}>Submit</Button>
</div>
</div>
Expand Down

0 comments on commit 1aa759e

Please sign in to comment.