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 && Fire @ THE BESTIES: Sandy, Ida, Beatrice and Hanh Solo #62

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

Conversation

seattlefurby17
Copy link

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?
Hanh: Testings
Ida: proud of contributing to the order fulfillment page, specifically implementing total_revenue and total_num methods
Sandy: adding bootstrap
Beatrice: cart methods
Each team member: what is one thing you were primarily responsible for that you would like targeted feedback on?
Hanh: custom methods
Ida: order fulfillment
Sandy: testing for order items
theme*

Beatrice: orders controller
How did your team break up the work to be done? with Trello cards and feedback templates to assign tasks
How did your team utilize git to collaborate? git branch, git merge and PR
What did your group do to try to keep your code DRY while many people collaborated on it? private methods for share attributes, before_action for controllers, fixtures for tests, and form partials.
What was a technical challenge that you faced as a group? validations without !, cookies issues and git out of sync
What was a team/personal challenge that you faced as a group? loss time due to personal issues.
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/1ksRVbvnkKLCVpVXj7uuW-Nd0klPX2Igx/view
What is your Trello URL? https://trello.com/b/qLAW6qrJ/petsy
What is the Heroku URL of your deployed application? https://petsy-pals.herokuapp.com/

Beatress and others added 30 commits November 17, 2020 15:17
Beatress and others added 28 commits November 24, 2020 17:26
Added spacing to homepage title for better presentation
Added border to homepage pictures to match products page
Added more pics of Churro
Added spacing to homepage title for better presentation
Added border to homepage pictures to match products page
Added more pics of Churro
Copy link

@kaidamasaki kaidamasaki left a comment

Choose a reason for hiding this comment

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

Great job! Your project made me super nostalgic which I think was exactly what you were setting out for.

While there were few rough edges you worked together great as a team and overcame a number of personal difficulties together, congratulations on making a working online store!

This project was intentionally a huge lift and you rose to the challenge admirably!

Also, don't take the rubric too seriously it's mostly to just make sure we look at everything important. (There's a reason we don't give grades depending on the number of check marks...)

I listed you as yellow mostly because of missing reviews, but a yellow on bEtsy is still an impressive accomplishment!

bEtsy

Functional Requirements: Manual Testing

Workflow yes / no
Before logging in
Browse all products, by category, by merchant Categories not implemented.
Leave a review Reviews not implemented.
Verify unable to create a new product ✔️
After logging in
Create a category Categories not implemented.
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 Not implemented.
Add another merchant's product ✔️
Check out ✔️
Check that stock was reduced Not implemented.
Change order-item's status on dashboard ✔️
Verify unable to leave a review for your own product Reviews not implemented.
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 ✔️ 98.72%! 🎉
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 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 Not implemented.
Checkout -> decrease inventory Not implemented.
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
Some edge cases missing.
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
Some edge cases missing.
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)
Some edge cases missing.
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
Reviews not implemented.

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

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 +20 to +25
/*!
* Bootstrap v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors
* Copyright 2011-2020 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/

Choose a reason for hiding this comment

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

You shouldn't have needed to copy/paste Boostrap into here. It was already imported on line 16.

@@ -0,0 +1,28 @@
class ApplicationController < ActionController::Base
# before_action :require_login

Choose a reason for hiding this comment

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

You should try to remember to clean up commented out code before pushing in the future.

Comment on lines +11 to +15
if @product.nil?
flash[:error] = "Product to add to cart not found"
redirect_to products_path
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 probably have lived in a controller filter, or at least a helper method (since you likely want to share this logic with edit_quantity and destroy).


private

def find_order

Choose a reason for hiding this comment

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

This just being named find_order makes me expect it will do it by id. I would probably have named it something like: find_order_for_shopper

Comment on lines +84 to +86
def find_product
@product = Product.find_by(id: params[:id])
end

Choose a reason for hiding this comment

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

The flash and redirect behavior you rolled one off above should probably have been moved into here:

Suggested change
def find_product
@product = Product.find_by(id: params[:id])
end
def find_product
@product = Product.find_by(id: params[:id])
if @product.nil?
flash[:error] = "Cannot find product"
redirect_to products_path
return
end
end

Comment on lines +4 to +5
<h3 class ="spotlight-padding">Your cart is empty!</h3>
<h3 class = "spotlight-padding"><%= link_to "Keep Shopping?", products_path %></h3>

Choose a reason for hiding this comment

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

You shouldn't use h3s for styling like this. You should be able to take all of the headings from a page and make a table of contents.

It's not something that's often done by sighted people but is really important if someone is trying to access your site with a screen reader.

if @order_item = OrderItem.find_by(product_id: @product.id, order_id: @shopper)
# Add to the existing quantity instead of creating a new item
@order_item.add_quantity(params["quantity"].to_i)
@order_item.save

Choose a reason for hiding this comment

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

Suggested change
@order_item.save
@order_item.save!

Comment on lines +52 to +54
order.products.each do |product|
return true if self.products.include?(product)
end

Choose a reason for hiding this comment

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

I think this loop always returns true.

I suspect there should have been a comparison to the merchant in here somewhere.


# validates_associated :order_items # one way street, infinite loop otherwise
validates :name, format: { :with => /\A[a-zA-Z]+\z/, :message => "Only letters allowed" }, :allow_nil => true
validates :email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }, :allow_nil => true

Choose a reason for hiding this comment

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

Nice email regex. I assume you grabbed it form somewhere.

Fun fact, there's an input type for email that will do client side validation for you: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email

(You still need server side validation because of stuff like Postman though.)

Comment on lines +10 to +11
spotlight_for_all_products = Product.all.sample
return spotlight_for_all_products

Choose a reason for hiding this comment

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

You don't need to assign the result to a variable here since you immediately return it:

Suggested change
spotlight_for_all_products = Product.all.sample
return spotlight_for_all_products
return Product.all.sample

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.

4 participants