forked from turingschool-projects/little_shop_v2
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User orders cancel #130
Merged
Merged
User orders cancel #130
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ed, updates OrderItems fulfilled to False, flash notice confirmation, redirect to User Orders index
…ton unless pending
…n Default User Order Show HTML
…er Order Show page
…r Show HTML with if block for non-pending status
…change_to? hook to update associated Item inventory
WHomer
approved these changes
May 25, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is looking nice.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR brings in the functionality of a User cancelling one of their Orders, and all the associated actions that happen because of it. An Order can only be cancelled if it is in a Pending state. The User is given a button to click on, but it will be disabled unless the Order is Pending.
When an Order is cancelled, it simultaneously updates the Order status to Cancelled, updates all Order Items to Fulfilled:False, and all Items have their previously spoken for Inventory returned to the Merchants. This requires the OrdersController Destroy method to iterate through Order Items and change their Fulfilled status to False.
Once an Order Item fulfillment status changes (to True or False), the Model will modify the Inventory of the corresponding Item. It will reduce the Inventory by the Order Items quantity if True, and add the quantity if False.
Resolves. #53