Skip to content

Conversation

@Brianwkhuffman
Copy link
Collaborator

WaitList includes a clear button on top
It maps through waitList/holdList and changes their status in db to "cancelled"

@Brianwkhuffman Brianwkhuffman added the hacktoberfest-accepted We're working for shirts! label Oct 26, 2020
Comment on lines +16 to +38
const clearReservations = () => {
let waitLength = waitList.length;
let holdLength = holdList.length;

if (waitLength === 0 && holdLength === 0) {
return alert('No reservations to cancel.');
}
if (waitLength !== 0) {
waitList.forEach((res) => {
let data = { queueStatus: 'cancelled' }
props.dispatchUpdateReservation(data, res.id);
});
alert(`Wait list cleared ${waitLength} reservations.`)
};
if (holdLength !== 0) {
holdList.forEach((res) => {
let data = { queueStatus: 'cancelled' }
props.dispatchUpdateReservation(data, res.id);
})
alert(`Hold list cleared ${holdLength} reservations.`)
}
return
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I don't think this is good. This requires the front end to fire off a request to the backend for every single reservation on the front, that could be a lot of calls. I think we need to create a new backend route that will update the reservations based on what's saved in the retailer's reservation array.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lemme know if you wanna discuss and we can talk about what that might look like.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I'll look into updating multiple documents with one call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted We're working for shirts!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants