vivejest - Vicki, Vera, Jessica and Stephanie (momasy)#32
vivejest - Vicki, Vera, Jessica and Stephanie (momasy)#32vwhwang wants to merge 374 commits intoAda-C13:masterfrom
Conversation
added category to merch dashboard and max width css
This reverts commit d38cb56.
…y_change All button styles add new category change
Merchant dashboard status filter
…e class added to pages without
Merchants index styling
Order items testing
bEtsyFunctional Requirements: Manual Testing
Major Learning Goals/Code Review
Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
Overall FeedbackGreat work overall! You've built a fully functional web store from top to bottom. This represents a huge amount of work, and you should be proud of yourselves!. I am particularly impressed by the way that you styled your site and your (super high!) test coverage. I do see some room for improvement around manual testing of edge cases and moving functionality into models. bEtsy is a huge project on a very short timeline, and this feedback should not at all diminish the magnitude of what you've accomplished. Keep up the hard work! Overall Feedback: Meets or Exceeds Standard Only the person who submitted the PR will get an email about this feedback. Please let the rest of your team know about it. |
| color: #444444; | ||
| } | ||
|
|
||
| @media screen and (max-width: 600px) { |
| if current_item | ||
| # params[:quantity].to_i to add up the quantity | ||
| if (current_item[:quantity] + params[:quantity].to_i) > @product.inventory | ||
| flash[:error] = "You cannot add more items than are in stock." | ||
| redirect_to product_path(@product.id) | ||
| else | ||
| current_item[:quantity] += params[:quantity].to_i | ||
| current_item.save | ||
| flash[:success] = "Successfully updated order item" | ||
| redirect_to order_path(@order_id) | ||
| end |
There was a problem hiding this comment.
This logic should probably live in the model.
| # Method to create a new order Item. | ||
| def create_new_orderItem | ||
| order_item = OrderItem.new({ | ||
| product_id: params[:product_id], | ||
| quantity: params[:quantity].to_i, | ||
| order_id: session[:order_id], | ||
| }) | ||
|
|
||
| if order_item.save | ||
| flash[:success] = "Item added to order" | ||
| redirect_to order_path(@order_id) | ||
| else | ||
| flash[:error] = "Could not add item to order" | ||
| redirect_to order_path(@order_id) | ||
| end | ||
| end |
There was a problem hiding this comment.
This should be a factory method on OrderItem.
| inventory_errors = 0 | ||
| order_items.each do |order_item| | ||
| if order_item.quantity > order_item.product.inventory | ||
| if order_item.product.inventory == 0 | ||
| order_item.destroy | ||
| else | ||
| order_item.quantity = order_item.product.inventory | ||
| order_item.save | ||
| end | ||
| inventory_errors += 1 | ||
| end | ||
| end | ||
|
|
||
| if inventory_errors > 0 | ||
| flash[:error] = "Some of the items in your cart are no longer in stock. We have updated your cart to reflect the current quantity." | ||
| redirect_to order_path(params[:id]) | ||
| return | ||
| end |
There was a problem hiding this comment.
This logic should have been in a method on Order.
Assignment Submission: bEtsy
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions. These should be answered by all members of your team, not by a single teammate.
Reflection