Skip to content

Commit 1aa759e

Browse files
author
Frederic Lavigne
committed
added "rewards" field to new challenge form
updated seed data with sample rewards #60
1 parent d8cdb58 commit 1aa759e

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

routes/account/workouts.js

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ router.get('/', checkAuthenticated, (req, res) => {
2424
if (err) {
2525
res.status(500).send({ ok: false });
2626
} else {
27-
// console.log('Retrieved', result);
2827
res.send(result.docs);
2928
}
3029
});

routes/market.js

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ router.get('/organization/challenges', checkAuthenticated, (req, res) => {
4444
if (err) {
4545
res.status(500).send({ ok: false });
4646
} else {
47-
// console.log('Retrieved', result);
4847
res.send(result.docs);
4948
}
5049
});

seed/market.json

+10-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"goal": 10,
1010
"unit": "workout",
1111
"activity": "CYCLING",
12-
"description": "Earn a water bottle for 10 bike commutes to work"
12+
"description": "Earn a water bottle for 10 bike commutes to work",
13+
"rewards": 1000
1314
},
1415
{
1516
"_id": "fitForWork",
@@ -21,7 +22,8 @@
2122
"goal": 30,
2223
"unit": "workout",
2324
"activity": "ANY",
24-
"description": "$100 health insurance credit for 30 workouts a year"
25+
"description": "$100 health insurance credit for 30 workouts a year",
26+
"rewards": 100
2527
},
2628
{
2729
"_id": "stairChallenge",
@@ -33,7 +35,8 @@
3335
"goal": 1000,
3436
"unit": "workout",
3537
"activity": "STAIRS",
36-
"description": "Bobble hat for 1000 stairs climbed this winter"
38+
"description": "Bobble hat for 1000 stairs climbed this winter",
39+
"rewards": 1000
3740
},
3841
{
3942
"_id": "runnersLifeInsurance",
@@ -45,7 +48,8 @@
4548
"goal": 20,
4649
"unit": "workout",
4750
"activity": "RUNNING",
48-
"description": "20% discount for 20 runs a year"
51+
"description": "20% discount for 20 runs a year",
52+
"rewards": 750
4953
},
5054
{
5155
"_id": "marathonQualifying",
@@ -57,6 +61,7 @@
5761
"goal": 1,
5862
"unit": "workout",
5963
"activity": "RUNNING",
60-
"description": "Run one marathon in less than 4 hours"
64+
"description": "Run one marathon in less than 4 hours",
65+
"rewards": 500
6166
}
6267
]

ui-react/src/Organization/NewChallenge.js

+22-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class NewChallenge extends Component {
1717
goal: 1,
1818
unit: 'workout',
1919
activity: 'RUNNING',
20-
description: 'Run one marathon in less than 4 hours'
20+
description: 'Run one marathon in less than 4 hours',
21+
rewards: 100
2122
};
2223
this.handleInputChange = this.handleInputChange.bind(this);
2324
this.submitNewChallenge = this.submitNewChallenge.bind(this);
@@ -105,16 +106,35 @@ class NewChallenge extends Component {
105106
onChange={this.handleInputChange}
106107
/>
107108
</FormGroup>
108-
<FormGroup className="some-class" legendText="Goal">
109109

110+
<FormGroup className="some-class" legendText="Goal">
111+
<p>
112+
Number of Workouts
113+
</p>
110114
<TextInput
111115
className="some-class"
112116
id="goal"
113117
label="Number of Workouts"
118+
type="number"
114119
value={this.state.goal}
115120
onChange={this.handleInputChange}
116121
/>
117122
</FormGroup>
123+
124+
<FormGroup className="some-class" legendText="Rewards">
125+
<p>
126+
Reward tokens in the system
127+
</p>
128+
<TextInput
129+
className="some-class"
130+
id="rewards"
131+
label="Rewards"
132+
type="number"
133+
value={this.state.rewards}
134+
onChange={this.handleInputChange}
135+
/>
136+
</FormGroup>
137+
118138
<Button onClick={this.submitNewChallenge}>Submit</Button>
119139
</div>
120140
</div>

0 commit comments

Comments
 (0)