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

Water && Earth (Marj, Maha, Jessica, Ting-Yi) #74

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

Conversation

jwinchan
Copy link

@jwinchan jwinchan commented Nov 25, 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? Marj - Search and Filter on Product Index Page, Maha - View page for Payment and Confirmation, Jessica - Compiling the shopping cart, Ting-Yi - Merchant Dashboard
Each team member: what is one thing you were primarily responsible for that you would like targeted feedback on? Marj - Styling for Add Product, Maha - Styling for Payment Page, Jessica - Use of controller filters, Ting-Yi - the logic and custom methods in orderitem controller/model
How did your team break up the work to be done? Utilized Trello board, open communication, and co-working sessions
How did your team utilize git to collaborate? We created lots of branches, created pull requests to merge those branches into the master.
What did your group do to try to keep your code DRY while many people collaborated on it? We utilized controller filters and helper methods as much as possible.
What was a technical challenge that you faced as a group? Figuring out the Search and Filter Bar (Thank you Marj and Ansel!)
What was a team/personal challenge that you faced as a group? Getting tasks completed in an efficient manner
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) https://drive.google.com/file/d/1lP_IcnwfYd08Fp3xP85tCEYVvEFK4cSr/view?usp=sharing
What is your Trello URL? https://trello.com/b/Hc82pZYK/betsy
What is the Heroku URL of your deployed application? https://safe-beach-45024.herokuapp.com/

jwinchan and others added 30 commits November 19, 2020 17:25
draft create action for order_item (do we need price for order_item?)
Updated User show with retired/shipped/cancelled/edit/delete; added working methods/tests for destroy/retired for products & shipped/cancelled for order_items
fixed create action for order_item
revised quantity calculation and stock for product
ichbinorange and others added 29 commits November 25, 2020 15:27
created validation tests for user model
added cc_cvv to orders table, added validates and revised order controller and payment view to include cc_cvv
add tests for orderitem validates & relations
tests for new/update/edit/update/destray for review
created category controller tests
tested custom model methods for order
Copy link

@beccaelenzil beccaelenzil 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 ✔️
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 ✔️
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 ✔️?
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) Rather than using the user show page for the merchant dashboard, it would be good to use a custom non-parameterized route that pulls the user_id from session (just as you have for cart).
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 See in-line comment
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 See in-line comment
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

✔️ (logic in order items controller)
✔️ (logic in order items controller)
I don't see this specific test. It looks like the section the controller that handles order_items that fail validations is not tested.
see above
✔️
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
✔️
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)

✔️
✔️
✔️
✔️
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

✔️
✔️
✔️
✔️

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
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 used controller filters, thoroughly tested your code, and beautifully styled your site. The user experience is very nice. Furthermore, good work going the extra step of deploying your site with OAuth.

One place that could benefit from refactoring is moving some of the order_item logic that's in the controller into custom model methods. Remember that manipulation of data is business, and is best put in the model.

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.

Comment on lines +109 to +112
if session[:user_id].nil?
flash[:error] = "You must be logged in to retire this item"
redirect_to root_path
return

Choose a reason for hiding this comment

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

This logic is in a couple places. Consider moving it to a controller filter require_login.

Choose a reason for hiding this comment

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

Jessica requested feedback: I would consider adding the require_login method to the applications controller because this functionality is used in multiple controllers.

Comment on lines +30 to +32
@order_item.quantity += params[:quantity].to_i
@order_item.price += chosen_product.price * params[:quantity].to_i
qty_limit = chosen_product.stock - @order_item.quantity

Choose a reason for hiding this comment

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

This logic is a bit "businessy". Consider how you could move it to model methods in orderItem.rb.

Comment on lines +57 to +58
@order_item.quantity = params[:quantity].to_i
@order_item.price = product.price * params[:quantity].to_i

Choose a reason for hiding this comment

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

This logic is repeated from above which is a good indication that it would be best to encapsulate this functionality in a model method.

Choose a reason for hiding this comment

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

Ting-Yi: This comment applies to your requested feedback.

</div>
</div>

<div class="form-row">

Choose a reason for hiding this comment

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

Marj requested feedback: The styles are beautiful! One thing I would consider is moving the make new category functionality into the same form as the make new product. The user experience is a little funny since if you enter all the information for a new product and then want to add a new category, when you click the make new category button, your product information is cleared.

</ul>
<% end %>

<%= form_with model: @order,url: complete_path(@order), method: :patch, class: 'order-form' do |f| %>

Choose a reason for hiding this comment

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

Maha requested feedback: I see that the class order-form is applied to the payment form, but I don't see any styles that correspond to this class. I believe this is from boostrap, but it seems that the rest of your html doesn't make use of bootstrap classes to make a justified form. I would recommend looking at a few more examples like this: https://mdbootstrap.com/snippets/jquery/pjoter-2-0/747937

Comment on lines +4 to +5
before_action :order_cart
before_action :find_user

Choose a reason for hiding this comment

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

Jessica requested feedback: These are great controller filters to add to the applications controller.

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