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

Pipes-StarMart #64

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

Pipes-StarMart #64

wants to merge 429 commits into from

Conversation

lmarianarp19
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? The first day we took time to plan and design our app carefully. We try to not work at the same file at the same time. When team work was needed we worked in pairs.
How did your team utilize git to collaborate? We use branches. Each person has their own branches for their changes and periodically we merge our branches.
What did your group do to try to keep your code DRY while many people collaborated on it? We move repeated methods into the application class. We also used helper methods and partial forms.
What was a technical challenge that you faced as a group? Pushing to heroku, Oauth authentications.
What was a team/personal challenge that you faced as a group? Understanding and communicating the specific details of a problem. Specially when the code was more complex.
What could your team have done better? We should take more breaks and not work so much after school hours. Also we should update trello board more often.
What was your application's ERD? (include a link) https://www.lucidchart.com/invitations/accept/27d5b7de-c0d8-44bf-a8f6-729f999bb77b
What is your Trello URL? https://trello.com/b/D38i27LH/starmart
What is the Heroku URL of your deployed application? https://starmart.herokuapp.com/

idevera and others added 30 commits October 24, 2017 08:56
…ed Irene and Bianca as legit merchants and gave them products and seed data
@droberts-sea
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 mostly - see inline comment
oAuth used for User authentication yes
Functionality restricted based on user roles some - can't edit another merchant's products, but can review my own
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 - good work!
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 - good work using has_many through:
Models
Validation rules for Models yes
Business logic is in the models yes - you do a good job keeping it out of the views, and I only noticed one place where it should be removed from the controller
Controllers
Controller Filters used to DRY up controller code yes, but see inline comments (especially re: restrict_merchant)
Testing
Model Testing yes - good work, especially on negative and edge cases
Controller Testing yes - missing tests for order_items#ship, otherwise good work
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 - love the theme! And the favicon!
The app layout uses Foundation's Grid yes
Content is organized with HTML5 semantic tags yes
CSS is DRY yes
Overall Great job overall! This site is attractive, well-organized and easy to navigate, and as far as I could tell everything works. Test coverage is solid, and I was not able to get away with any malicious behavior. As with any large project there are a few places where things could be cleaned up, and I've tried to point those out inline, but in general this is a very strong submission. You've clearly put in a ton of effort on the project, and it's paid off. Keep up the hard work!

IMPORTANT: Whoever submitted the PR (and thus will get the notification about this feedback) should share this with their teammates.

@merchant = Merchant.find_by(id: expected_merchant_id)

if @login_merchant && @login_merchant.id == @merchant.id
unless @merchant

Choose a reason for hiding this comment

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

The format of this method is a little strange to me - I think you might be able to design a cleaner interface.

Also, line 53 (unless @merchant) will never happen, because if the @merchant is nil the the call to @merchant.id on line 52 will produce an error.


before_action only:[:show] do
@try_merchant = Merchant.find_by(id: params[:id])
restrict_merchant(@try_merchant)

Choose a reason for hiding this comment

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

If you're restricting the URI parameter to only be the ID of the logged in merchant, then why have a parameterized URI at all? It would probably make more sense to always show the logged in merchant's details.

# TODO: TAKE ALOOK AT THIS. WHAT IS THE MERCHANT ID COMING FROM? SESSIONS? ALREADY A @LOGIN_MERCHANT
before_action only:[:index] do
restrict_merchant(params[:merchant_id])
end

Choose a reason for hiding this comment

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

I very much agree with that TODO - by my reading, restrict_merchant checks that the argument matches the logged in merchant's ID, which in this case will always be true.

order.products.each do |item|
order.order_items.each do |order_item|
item.inventory -= order_item.quantity
item.save

Choose a reason for hiding this comment

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

This would be a good bit of work to do in the Model, possibly as a custom method on Order.

end

def create
if @login_merchant

Choose a reason for hiding this comment

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

You have this if @login_merchant many times in this controller, would it be possible to DRY this up with a filter?


resources :orders, only: [:show, :index] do
resources :payments, only: [:index, :new, :create]
end

Choose a reason for hiding this comment

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

I'm not sure why the payments routes are nested under orders here. Seems to me that the routes for a payments ought not to be parameterized at all, but instead take cart info from the session.


def order_items_params
params.permit(:quantity, :product_id)
end

Choose a reason for hiding this comment

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

This helper method is never called! Be careful what you copy-paste!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants