Skip to content

Conversation

@vwhwang
Copy link

@vwhwang vwhwang commented Jun 19, 2020

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

Prompt Response
Each team member: what is one thing you were primarily responsible for that you're proud of? Vicki - category many to many relationships and getting comfortable with deploying heroku (ish). Jessica - When one person checks out and another person still has that item in their cart, it updates the inventory to what's available if they try to check out. Vera - Create order items and Cart when the people cannot add more items if there is not enough inventory. Stephanie - side bar only show up on certain pages and carousel.
Each team member: what is one thing you were primarily responsible for that you would like targeted feedback on? Vicki - order controller tests. Stephanie - category model test. Jessica - merchant authorization for certain actions . Vera - Order items controller and tests.
How did your team break up the work to be done? We used trello and the users story to the to-do list. We break it up in the stand up each day.
How did your team utilize git to collaborate? We created branches to work on individually and make PR for review before merge.
What did your group do to try to keep your code DRY while many people collaborated on it? We made some partials and try to reuse style classes. We also use helper methods.
What was a technical challenge that you faced as a group? Github / Heroku authentication.
What was a team/personal challenge that you faced as a group? carousel and filter status. As a group was hard to make sure we don't step on each other's toes/code.
What was your application's ERD? (upload this to Google Drive, change the share settings to viewable by everyone with a link, and include a link) see trello
What is your Trello URL? https://trello.com/b/Jn7dIbHr/vivejest
What is the Heroku URL of your deployed application? https://momasy.herokuapp.com/

vwhwang and others added 30 commits June 12, 2020 13:15
added category to merch dashboard and max width css
This reverts commit d38cb56.
vwhwang and others added 28 commits June 18, 2020 11:48
…y_change

All button styles add new category change
@kaidamasaki
Copy link

bEtsy

Functional Requirements: Manual Testing

Workflow yes / no
Deployed to Heroku ✔️
Before logging in
Browse all products, by category, by merchant ✔️
Leave a review ✔️
Verify unable to create a new product ✔️
After logging in
Create a category ✔️
Create a product in that category with stock 10 ✔️
Add the product you created to your cart ✔️
Add it again (should update quantity) ✔️
Verify unable to increase quantity beyond stock ✔️
Add another merchant's product ✔️
Check out Broken on deployed copy.
Check that stock was reduced Checkout did not work.
Change order-item's status on dashboard ✔️
Verify unable to leave a review for your own product ✔️
Verify unable to edit another merchant's product by manually editing URL ✔️
Verify unable to see another merchant's dashboard by manually editing URL ✔️

Major Learning Goals/Code Review

Criteria yes / no
90% reported coverage for all controller and model classes using SimpleCov ✔️ 96.66%!
Routes
No un-needed routes generated (check reviews) ✔️
Routes not overly-nested (check products and merchants) ✔️
Merchant dashboard and cart page use a non-parameterized routes (should pull merchant or cart ID from session) ✔️
Controllers
Controller-filter to require login by default ✔️
Helper methods or filters to find logged-in user, cart, product, etc ✔️
No excessive business logic A moderate amount of business logic lives in the controller.
Business logic that ought to live in the model
Add / remove / update product on order ✔️
Checkout -> decrease inventory ✔️
Merchant's total revenue ✔️
Find all orders for this merchant (instance method on Merchant) ✔️
Selected Model Tests
Add item to cart:
- Can add a good product
- Can't add a product w/o enough stock
- Can't add a retired product
- Can't add to an order that's not in cart mode
- Logic specific to this implementation
(Only the specific logic.)
Get orders for this merchant:
- Includes all orders from this merchant
- Doesn't include orders from another merchant
- Orders are not included more than once
- Does something reasonable when there are no orders for this merchant
✔️ (Mostly.)
Selected Controller Tests
Add item to cart:
- Empty cart (should be created)
- Cart already exists (should add to same order)
- Product already in cart (should update quantity)
- Bad product ID, product is retired, quantity too high, or something like that (error)
✔️ (Mostly.)
Leave a review:
- Works when not logged in
- Works when logged in as someone other than the product's merchant
- Doesn't work if logged in as this product's merchant
- Doesn't work if validations fail
✔️ (Mostly.)

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Elegant/Clever
Descriptive/Readable
Concise
Logical/Organized

Overall Feedback

Great 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) {

Choose a reason for hiding this comment

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

Oooh, responsive design!

Comment on lines +22 to +32
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

Choose a reason for hiding this comment

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

This logic should probably live in the model.

Comment on lines +98 to +113
# 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

Choose a reason for hiding this comment

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

This should be a factory method on OrderItem.

Comment on lines +51 to +68
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

Choose a reason for hiding this comment

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

This logic should have been in a method on Order.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants