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

Blue Yourself - Addie, Bo, Janice, Rana #23

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

Conversation

add2point71dots
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
How did your team break up the work to be done? We all did testing in various forms. Rana mostly focused the product (model, controller, and views) and seeding our data. Addie mostly worked with vendor/oauth and reviews (models, controller, and views). Bo did most of the work on the cart (orders, orderitems model, controller and views). Janice worked on the vendor fulfillment pages, categories (model, controller, and views), some cart functionality, and the vast majority of CSS. We all pitched in to debug each other's code, as well.
How did your team utilize git to collaborate? We worked on our own branches, and then pushed our branches to github and used pull requests to merge them.
What did your group do to try to keep your code DRY while many people collaborated on it? We had some helper methods and before actions, and fixtures in our tests. We definitely could have done more, but with the amount of time we had, we prioritized functionality.
What was a technical challenge that you faced as a group? Figuring out how everything relates and which pieces of code will affect code that others were working on. We learned our lesson to run all the tests before merging a branch, even if we didn't think our branch affected other parts of the project. We also found it difficult to manage model relationships when the involved models are owned by more than one team member.
What was a team/personal challenge that you faced as a group? We had a some challenges splitting up the work in a way that everyone was happy with, communicating exactly which pieces we were working on, and honoring agreements regarding how to divvy work and supporting one and another when said agreements were broken. But by the end, we all pulled together and made something we were happy with. A personal challenge was to not become too attached to any one part of the project, as well as find the right balance between learning opportunities and project completion.
What could your team have done better? TDD - we started out strong writing tests first, but as we went along, we mostly wrote tests after the fact. Our code could definitely be DRY-er, too.
What was your application's ERD? (include a link) This is the ERD that was gem generated from our project (though it doesn't represent the "many" side of relationships well, it seems: https://github.com/add2point71dots/betsy/blob/master/erd.pdf Here is an ERD that Rana made early on in our project where the relationships are more accurate but the fields have changed a bit: https://github.com/add2point71dots/betsy/blob/master/ERD-betsy.png
What is your Trello URL? https://trello.com/b/Q83lG9BC/blue-yourself
What is the Heroku URL of your deployed application? https://blueyourself.herokuapp.com/

botrethewey and others added 30 commits April 22, 2017 20:33
…Through a method to choose a random photo in the category model. Messed around with the latest migration (un-commenting time-stamp).
Pimped out category views. Also tweaked a few oversights in the CSS. …
Pimped out category views. Also tweaked a few oversights in the CSS. …
Attempting to correct a grammatical error in a commit message!
added some orderitem controller tests and fixed validation method syn…
add2point71dots and others added 27 commits April 28, 2017 12:06
makes number appear in cart on all pages
Formatted checkout. It's rugged. But it's decent.
@kariabancroft
Copy link

bEtsy

What We're Looking For

Feature Feedback
Baseline
Appropriate Git Usage with all members contributing Yes
Answered comprehension questions Yes
Trello board is created and utilized in project management Yes
Heroku instance is online Yes
General
Nested routes follow RESTful conventions Yes
oAuth used for User authentication Yes - set up with Google. Neat!
Functionality restricted based on user roles Yes - I like the way you've created the require_login_match method to ensure appropriate vendor login
Products can be added and removed from cart Yes
Users can view past orders Yes
Merchants can add, edit and view their products Yes
Errors are reported to the user Yes - the order fulfillment page is nice with the error descriptions as well as the overall errors
Order Functionality
Reduces products' inventory Yes
Cannot order products that are out of stock Yes
Changes order state Yes
Clears current cart Yes
Database
ERD includes all necessary tables and relationships Yes
Table relationships Schema looks good
Models
Validation rules for Models Yes - lots of different types used
Business logic is in the models Yes - though I still think you could do more. For ex, the total quantity and total price logic in the OrdersController should be done in a model rather than in the controller. The way order items are created could also be greatly simplified by using some sort of method that would check the types of things you are looking for.
Controllers
Controller Filters used to DRY up controller code Yes - though some are used unnecessarily. Using a controller filter for a single controller action seems overkill - like the show_cart actions in the OrdersController
Testing
Model Testing Yes
Controller Testing Yes
Session Testing Yes
SimpleCov at 90% for controller and model tests Yes
Front-end
The app is styled to create an attractive user interface Yes
The app layout uses Foundation's Grid Yes - though I think that some of the pages like the product index would really be well-served to have foundation implemented
Content is organized with HTML5 semantic tags Yes
CSS is DRY No - there are a lot of duplicated declarations related to flex box stuff, font sizes, margins, etc. I think it is primarily based on the way you're using one class for one element, as opposed to considering using multiple classes for a single element to clean up your CSS.
Overall
Using the template views seem like a nice idea but this causes you to duplicate a great deal of the "normal" application view stuff. If you changed the nav bar, then you'd have to change it in several other places. You should be using partials not full page templates to prevent this duplication
See some other notes inline on the PR

end
# if the prduct has already been added to the cart, then store the current inventory of that product into item_quantity
if @cart.orderitems.find_by(product_id: params[:orderitem][:product_id])
item_quantity = @cart.orderitems.find_by(product_id: params[:orderitem][:product_id]).quantity

Choose a reason for hiding this comment

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

Here you're re-querying the database which is unnecessary. The above result should be stored in a variable so you don't do a duplicate query.

# shopper attemps to add a new item to a cart without specifying quantity
elsif quantity == 0
flash[:failure] = "You must add at least 1 item to the cart"
redirect_to product_path(product.id)

Choose a reason for hiding this comment

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

Room to DRY up these conditionals since only the first line is unique within each statement.

end

def fulfillment_cancelled
render 'fulfillment', layout: 'fulfillment-template'

Choose a reason for hiding this comment

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

Seems like since each of these controller actions are the same, that you don't need separate controller actions for this action.

end
else
session[:vendor_id] = vendor.id
flash[:success] = "Logged in successfully!"

Choose a reason for hiding this comment

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

Duplication here you can avoid by putting outside the conditional statement


private

def tally_earnings

Choose a reason for hiding this comment

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

This is not appropriate for the controller and should all be within the model

<%= f.label :email %><%= f.text_field :email%>
<%= f.label :street_address %><%= f.text_area :street_address%> <br>
<%= f.label :city %><%= f.text_field :city %>
<%= f.label :state %><%= f.select :state, [

Choose a reason for hiding this comment

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

This drop down is cool! In the future - you could use "locales" and put this type of thing into a separate file so that it's not directly in your view

@@ -0,0 +1,18 @@
<h1> <%= filter %> </h1>
<% @order_items.where(status: filter).each do | order_item | %>

Choose a reason for hiding this comment

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

The filtering generally should not be done within the view - but rather the controller (or even the model). Whatever order items you're looking for should be passed to the view - already filtered

<% @vendor.products.each do |product| %>
<section class='product'>
<h4 class="name"><%= product.name %></h4>
<h4 class="price">$<%= sprintf('%.2f', product.price) %></h4>

Choose a reason for hiding this comment

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

Might be good to create a view helper for this in the future so that you can format all prices the same way across all views without needing to duplicate this logic

it "won't create a new orderitem instance if product already exists in the cart" do
@cart.add_to_cart({ :orderitem => { product_id: products(:five).id, quantity: 1 } })
before = @cart.orderitems.count
@cart.add_to_cart({ :orderitem => { product_id: products(:five).id, quantity: 1 } })

Choose a reason for hiding this comment

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

These tests seems to be using this hash throughout so it would be good to DRY this up and use a shared variable

end

it "rejects invalid categories" do
invalid_categories = ['at', 'do', 'phd thesis', 1337, nil]

Choose a reason for hiding this comment

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

I like the way you're using this array to test multiple scenarios for the same outcome

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