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

Alice, Noor, Schanen, Blaine Fire & Earth AloeBae bEtsy #73

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

Conversation

Blaine206
Copy link

Assignment Submission: bEtsy

CHECK THE PULL REQUEST TEMPLATE IN CODE
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?
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? (upload this to Google Drive, change the share settings to viewable by everyone with a link, and include a link)
What is your Trello URL?
What is the Heroku URL of your deployed application?

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

bEtsy

Functional Requirements: Manual Testing

Workflow yes / no
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 ✔️, although it's as little hard to find where to add 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 ✔️
Check that stock was reduced ✔️
Change order-item's status on dashboard ⚠️, but it tells me that the order is now invalid! AND my product has now dissapeared from the system!
Verify unable to leave a review for your own product ✔️
Verify unable to edit another merchant's product by manually editing URL ⚠️ By using the URL I can edit someone's product!
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 ⚠️ 35.3%
Routes
No un-needed routes generated (check reviews) ⚠️, lots of unneeded routes
Routes not overly-nested (check products and merchants) ✔️, no triple-nested routes.
Merchant dashboard and cart page use a non-parameterized routes (should pull merchant or cart ID from session) ✔️
Controllers
Controller-filter to require login is applied to all merchant-specific actions (update/add item, add category, view merchant dashboard, etc.) - filter method is not duplicated across multiple files ✔️
Helper methods or filters to find logged-in user, cart, product, etc ✔️
No excessive business logic ✔️
Business logic that ought to live in the model
Add / remove / update product on order ✔️
Checkout -> decrease inventory ✔️
Merchant's average 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
⚠️, no tests for this
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
⚠️, there's no model method for this that I can tell, so no model tests for it.
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)
⚠️, You started on this but didn't get very far
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
⚠️ Tests for validations and successful review, but no test to ensure I can't review my own products

Code Style Bonus Awards

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

Quality Yes?
Descriptive/Readable
Logical/Organized

Overall Feedback

A few weird notes. If I edit another merchant's products suddenly their orders show up in my dashboard. Granted I shouldn't be able to edit their product, but this was unexpected. I suddenly had an order for a hairy chest, which was amusing.

Areas that aren't working: Merchant Dashboard doesn't calculate total earnings or other numbers beyond number of orders and orders in each category. You also don't have much in the way of authorization to prevent malicious merchants from hacking other products and taking them over.

You also have very little in the way of effective testing. I think you all observed how this caused issues when you tried to merge in features and discovered things weren't working. More through testing could help reduce team conflict and make the process of absorbing new features smoother. I would have sacrificed the reviews feature to have more confidence in the code via tests.

Positive Notes

That said, your bEtsy project works pretty well in the browser. The site looks good and has the core functionality. You made very good use of filters and your oauth works really well. This is a solid project submission.

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.

Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root to: 'homepages#homepage'
resources :homepages, only: [:index]

Choose a reason for hiding this comment

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

Since you're using the root path for this controller you don't need this.

Suggested change
resources :homepages, only: [:index]

delete '/logout', to: 'merchants#destroy', as: 'logout'

resources :products
resources :merchants

Choose a reason for hiding this comment

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

Do you need all the CRUD routes for merchants?

resources :homepages, only: [:index]

resources :products do
resources :order_items, only: [:create, :destroy]

Choose a reason for hiding this comment

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

You don't seem to be using the nested destroy route for order items.

patch '/orders/:id/cancel', to: 'orders#cancel', as: 'cancel'

resources :reviews, only: [:create, :update]
resources :order_items

Choose a reason for hiding this comment

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

Again you don't need all the CRUD routes here?

@@ -0,0 +1,15 @@
joinone:

Choose a reason for hiding this comment

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

In this fixture you're missing inventory, description, and photo.

Comment on lines +48 to +51
post product_order_items_path(products(:product_one))
id = Product.find_by_id(products(:product_one).id)
expect {
delete product_order_item_path(id)}.must_change 'OrderItem.count', -1

Choose a reason for hiding this comment

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

Your form requires the quantity you're adding to the product, and you need both the product and order ids.

Suggested change
post product_order_items_path(products(:product_one))
id = Product.find_by_id(products(:product_one).id)
expect {
delete product_order_item_path(id)}.must_change 'OrderItem.count', -1
post product_order_items_path(products(:product_one).id), params: { order_item: { quantity: 1 } }
product_id = Product.find_by_id(products(:product_one).id).id
id = OrderItem.find_by(product_id: product_id, order_id: session[:cart_id]).id
expect {
delete product_order_item_path(product_id, id)
}.must_change 'OrderItem.count', -1

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