Skip to content

Commit 6ab63e3

Browse files
committed
set the status of newly added volunteers on pending #33
1 parent 4e2a4c1 commit 6ab63e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

routes/api/missions.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,15 @@ exports.update = (req, res) => {
6464
data.removed = oldCrewIDs.filter(id => !newCrewIDs.includes(id));
6565
data.added = newCrewIDs.filter(id => !oldCrewIDs.includes(id));
6666

67+
newData.crew // set the status of newly added volunteers on pending
68+
.filter(a => data.added.includes(a.volunteer))
69+
.forEach(a => a.status = 'pending');
70+
6771
if (newData.start || newData.end) {
6872
data.unchanged = oldCrewIDs.filter(id => newCrewIDs.includes(id));
6973
newData.crew
70-
.filter(assignment => assignment.status === 'yes')
71-
.forEach(assignment => assignment.status = 'pending');
74+
.filter(a => a.status === 'yes')
75+
.forEach(a => a.status = 'pending');
7276
}
7377
}
7478

0 commit comments

Comments
 (0)