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

Soulsearchers/India/Olga/Li/Taylor #85

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

Conversation

TaylorMililani
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? Taylor: I did most of the css and I'm really proud that I was able to make a picture our header. Li: Filter orders by status. India: I was primarily responsible for merchants/users and I’m proud of being able to make OAuth work accurately. Olga: Deployment to Heroku.
Each team member: what is one thing you were primarily responsible for that you would like targeted feedback on? Taylor: Orderitem & Reviews controller/models/tests. Li: testing for sessions. India: user model/controller/test. Olga: product model/controller/test
How did your team break up the work to be done? We split up the models, each person was responsible for 1 or 2 models and everything associated. We would pair up if our models interacted.
How did your team utilize git to collaborate? Branches and pull requests.
What did your group do to try to keep your code DRY while many people collaborated on it? Every time we merged we looked over everything and made adjustments.
What was a technical challenge that you faced as a group? Intersections between different model functionalities. Testing.
What was a team/personal challenge that you faced as a group? Managing git. Anxiety, nerves, sleep deprivation.
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://files.slack.com/files-pri/T016J51T03T-F01EYRL4TB5/image.png
What is your Trello URL? https://trello.com/invite/b/yTmVDmfq/9cda7a5c73d475fd5e8c963ead3117b8/soulstore
What is the Heroku URL of your deployed application? https://adies-soulstore.herokuapp.com/

@jbieniosek
Copy link

jbieniosek commented Dec 5, 2020

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) ? (Merchant dashboard uses user id in the route)
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 ? If the user is not logged in, there are other checks that stop them from doing these things, but require_login is not used as a baseline check
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 ? (This almost works, see below for bug)
Merchant's total revenue ✔️
Find all orders for this merchant (instance method on Merchant) ✔️ (This works, but I would suggest a modification, see below)
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
? Missing some
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
? Missing some
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)
? Missing some
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
? Missing some

Code Style Bonus Awards

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

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

Overall Feedback

Great work Soul Searchers! 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 controlled the user access to the different parts of the site. All of the checks were in place to ensure that only a user who has permissions to access or do something was able to! Nice work!

I do see some room for improvement around improving the tests around unexpected use or incorrect use. I noticed that many of the tests ensure that valid actions are successful, and those tests are necessary and very useful, but it's also important to think through all of the disallowed use cases and ensure that those sequences fail.

Here is a list of bugs that I found:

  1. Login is broken (see inline comments for details)
  2. Adding item A to the shopping cart and then adding item A to the shopping cart again does not update the quantity, rather it adds the second item A as a new item in the shopping cart.
  3. After checkout with the above scenario (two item A order items), the stock of the item is not updated to reflect both purchases
  4. Merchant dashboard has a route error and action error (Hide button uses GET, should be PATCH, and no action for hide once the route is fixed)
  5. Merchant orders: This isn't a bug exactly, but when a merchant is managing their orders, they see a list of order items. Each order item has a "ship" button, but clicking the button ships the entire order, not just the order item. If a button is paired with an item, but causes changes to multiple items, that can be confusing for a user. I would recommend grouping the order items by orders, and just having one set of buttons for each order, rather than for each order item, or changing the system so that order items all ship separately.

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.

if user.save
flash[:success] = "Logged in as new user #{user.username}"
else
head :not_found
Copy link

@jbieniosek jbieniosek Dec 5, 2020

Choose a reason for hiding this comment

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

Line 24: head :note_found combined with the redirect down below on line 26 causes an error: "Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return". Removing this line fixes that issue.

else
head :not_found
flash[:error] = "Could not create new user account: #{user.errors.messages}"
return redirect_to root_path

Choose a reason for hiding this comment

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

Stylistically, this should be two lines:
redirect_to root_path
return

end

session[:user_id] = user.id
return redirect_to root_path

Choose a reason for hiding this comment

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

Same as line 26

user = User.new
user.uid = auth_hash[:uid]
user.provider = "github"
user.username = auth_hash["info"]["name"]

Choose a reason for hiding this comment

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

This line causes the login bug that I mentioned in the feedback notes. In the auth_hash ["info"]["name"] is an optional field and can be nil. If it is nil (as mine was when I tested) this causes the validation that the username has to exist to fail. To fix this, I would suggest using auth_hash["info"]["login"] as an alternative to name, or removing the validation. It is important to check that if you are validating on something, it will always exist in a valid case.

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