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

Tor, Angelica, Hannah - SuperMarket Betsy - Octos #18

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

Conversation

hannahlcameron
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 broke up work assignments evenly by models (2 each) and then worked our way through the controllers as we needed them. We continued to assign work based off of priority and difficulty of task. We worked mostly independently, but closely coordinated so that we were in sync with each other.
How did your team utilize git to collaborate? We used git to collaborate by leveraging the ability to push branches up got git. We CR-ed these branches before we merged them into our master, which cut down on bugs and helped make sure we all knew what was going on in our code base.
What did your group do to try to keep your code DRY while many people collaborated on it? We utilized view helpers and partials to keep things dry. We also assigned work with this in mind so we ran into fewer issues.
What was a technical challenge that you faced as a group? The conditional validations on orders that showed/didn't show personal information on the site as appropriate.
What was a team/personal challenge that you faced as a group? You only gave us three people.
What could your team have done better? Fine, we could have had higher test coverage, but we're happy with our 91%.
What was your application's ERD? (include a link) https://www.lucidchart.com/documents/edit/2292d0d1-d497-4a72-ba8f-1089ed986071/0?shared=true&existing=1&docId=2292d0d1-d497-4a72-ba8f-1089ed986071
What is your Trello URL? https://trello.com/b/TSmAKxla/supermarket
What is the Heroku URL of your deployed application? https://superheromarket.herokuapp.com/

amcejamorales and others added 30 commits April 21, 2018 16:39
…out paths in view, update uid to type string
…ntication merge to test with an authenticated user
… added in nested merchant routes to facilitate this
…gory route, added validation to category model to have uniqueness be true for category
torshimizu and others added 28 commits April 27, 2018 10:12
@droberts-sea
Copy link

bEtsy

What We're Looking For

Feature Feedback
Baseline
Appropriate Git Usage with all members contributing yes - I'm glad that code reviews worked well for you
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 mostly
oAuth used for User authentication yes - good work getting Google sorted out
Functionality restricted based on user roles some - see inline (products controller)
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
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 yes
Models
Validation rules for Models yes
Business logic is in the models mostly - some places it's not enough, some places it's overdone / overcomplicated
Controllers
Controller Filters used to DRY up controller code yes
Testing
Model Testing yes
Controller Testing mostly - Many test cases missing around authorization. Since these mostly rely on controller filters they won't show up in simplecov, but they're still important! See inline for examples.
Session Testing yes
SimpleCov at 90% for controller and model tests yes - great job!
Front-end
The app is styled to create an attractive user interface yes - that contrast is a little hard to swallow, but it fits the theme and makes for a consistent look and feel
Content is organized with HTML5 semantic tags yes
CSS is DRY yes
Overall Great work overall! You've built a fully functional web store from top to bottom, everything short of payment processing. This represents a huge amount of work, and you should be proud of yourselves! Your code is pretty well organized all the way from the CSS to the database, and I am quite happy with this submission. There are definitely places where things could be cleaned up or refined, or where there are feature gaps you might like to fill - I've tried to outline some of these below. However 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.


def product_params
return params.require(:product).permit(:name, :merchant_id, :stock, :price, :description, :photo_url, :category_ids => [])
end

Choose a reason for hiding this comment

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

Product params should not include the merchant ID - you should be taking that from the session! I was able to change the owner of a product, effective "stealing" it.

def edit; end

def update
@product.assign_attributes(product_params)

Choose a reason for hiding this comment

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

Edit and update should both be making sure that the logged-in user is also the owner of the product. I was able to change the info on someone else's product by typing the URL into the address bar.


def destroy
if @product.merchant_id == @logged_merchant.id

Choose a reason for hiding this comment

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

Here you're checking for product ownership - good work. Since you need it in multiple places, this would be a good candidate for a controller filter.


order_items.each { |order_item|
order_status = Order.find_by(id: order_item.order_id).status
if order_status == status || status == "all"

Choose a reason for hiding this comment

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

On line 24, why not order_item.order.status?

orders_and_items = {}
orders = self.orders
order_ids = orders.map { |order| order.id }
order_ids.each { |order_id| orders_and_items[order_id] = [] }

Choose a reason for hiding this comment

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

I'm not sure what this method is accomplishing. Why not start with orders.where(status: status), and then for each of those orders say order.order_items? Seems like putting it all into a hash of arrays is redundant.

it 'sends does not update a product for invalid data' do
orderitem = {
product_id: Product.first.id,
order_id: Order.first.id,

Choose a reason for hiding this comment

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

What is this test name?

describe 'ship' do
it "allows you to ship an item that exists" do
order_item = OrderItem.create(order_id: Order.first.id, product_id: Product.first.id, quantity: 1, status: "pending")
order_item.status.must_equal "pending"

Choose a reason for hiding this comment

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

I would probably include some test cases around auth here - what if you're not logged in? What if you're logged in as someone other than the merchant offering this product?

describe ProductsController do
describe 'guest user' do
describe 'index' do
it 'succeeds with multiple products for a guest user' do

Choose a reason for hiding this comment

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

You need to include negative cases for the things a guest user / the wrong user can't do.

it "wont' let you review if it's your own product" do
merchant = Merchant.first
merchant.products.length.must_be :>, 0
login(merchant)

Choose a reason for hiding this comment

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

Good! More of this sort of test.

it "returns 0.0 for the total revenue of a merchant with zero orders" do
merchant = Merchant.new
result = merchant.total_revenue_by("all")
result.must_equal 0.0

Choose a reason for hiding this comment

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

Good catch of this edge 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.

4 participants