Skip to content
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

Fixing order tests #37

Open
wants to merge 127 commits into
base: master
Choose a base branch
from
Open

Conversation

ChubbyCub
Copy link

bEtsy

Congratulations! You're submitting your assignment! These comprehension questions should be answered by all members of your team, not by a single teammate.

Comprehension Questions

Question Answer
Each team member: what is one thing you were primarily responsible for that you're proud of?
Each team member: what is one thing you were primarily responsible for that you would like targeted feedback on?
How did your team break up the work to be done?
How did your team utilize git to collaborate?
What did your group do to try to keep your code DRY while many people collaborated on it?
What was a technical challenge that you faced as a group?
What was a team/personal challenge that you faced as a group?
What was your application's ERD? (include a link)
What is your Trello URL?
What is the Heroku URL of your deployed application?

Faiza1987 and others added 30 commits April 30, 2019 13:57
…th and all associated process in relevant files - config/initializers, test_helper, application_controller, etc.
laneia and others added 29 commits May 7, 2019 09:25
Added user model tests and bootstrap navbar
fixed reviews controller and tests, added new view page
@tildeee
Copy link

tildeee commented May 20, 2019

bEtsy

What We're Looking For

Manual testing

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

Code Review

Area yes / no
Routes
No un-needed routes generated (check reviews) x
Routes not overly-nested (check products and merchants) You probably don't need to nest all of the actions of products into users (You probably just need to nest products#index under user)
Merchant dashboard and cart page use a non-parameterized routes (should pull merchant or cart ID from session) x
Controllers
Controller-filter to require login by default x
Helper methods or filters to find logged-in user, cart, product, etc x. You end up calling Order.find_by(id: cookies[:order_id]) in a view which should be refactored
No excessive business logic Hm, the CreateOrder module is interesting, but ends up being unused?
Business logic that ought to live in the model
Add / remove / update product on order This tightly coupled logic lives in the OrderItemController right now
Checkout -> decrease inventory Decreasing inventory shouldn't live in the controller
Merchant's total revenue x
Find all orders for this merchant (instance method on Merchant) Finding all of the orders relevant to a certain Merchant shouldn't live in the OrdersController
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
Does not have tests beyond custom methods
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
Does not have tests beyond validations
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)
Not very granular
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
x

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 y'all did the following:

  • Overall, your code organization is great! I think that all of the controllers largely looked like how I expected and wanted them to look :)
  • The complex features are all working very well-- cart and authorization!
  • The look/feel of the site is great :)

I do see some room for improvement around...

  • It seems like model tests were a low-priority for the team
  • I didn't see the flash messages in a lot of cases
  • Sometimes, I see some places in your code in which y'all elected to use ActiveRecord wheres and such instead of the ActiveRecord relationships. For example, your User class has a method to find_user_products that does return Product.where(user_id: self.id) ... Actually, the has_many :products line already sets it up so that you can just do user.products and it will do literally the same thing! :)
  • Continuing the above, point, I want to point out this view logic that I would want to see refactored:

Originally, you all have:

<% @order.orderitem_ids.each do |id| %>
        <% order_item = Orderitem.find_by(id: id)%>
        <% product = Product.find_by(id: order_item.product_id) %>
        <tr>
          <td><%= product.name %></td>
          <td><%= number_to_currency(product.price) %></td>
# ...

You can do the same code with

<% @order.orderitems.each do |order_item| %>
        <tr>
          <td><%= order_item.product.name %></td>
          <td><%= number_to_currency(order_item.product.price) %></td>
# ...

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!

Only the person who submitted the PR will get an email about this feedback. Please let the rest of your team know about it.

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