Skip to content

Commit

Permalink
set the status of newly added volunteers on pending #33
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbeier committed Apr 27, 2017
1 parent 4e2a4c1 commit 6ab63e3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions routes/api/missions.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,15 @@ exports.update = (req, res) => {
data.removed = oldCrewIDs.filter(id => !newCrewIDs.includes(id));
data.added = newCrewIDs.filter(id => !oldCrewIDs.includes(id));

newData.crew // set the status of newly added volunteers on pending
.filter(a => data.added.includes(a.volunteer))
.forEach(a => a.status = 'pending');

if (newData.start || newData.end) {
data.unchanged = oldCrewIDs.filter(id => newCrewIDs.includes(id));
newData.crew
.filter(assignment => assignment.status === 'yes')
.forEach(assignment => assignment.status = 'pending');
.filter(a => a.status === 'yes')
.forEach(a => a.status = 'pending');
}
}

Expand Down

0 comments on commit 6ab63e3

Please sign in to comment.