Pipes - Lauren and Angela - Ride Share Rails#19
Open
awilson2017 wants to merge 93 commits into
Open
Conversation
…ngers', and 'Create Driver'.
… trip, driver of trip, and rating of trip. Also displayed total cost.
…for each passenger's rides.
…ng AND add CSS drop down
Rideshare-RailsWhat We're Looking For
|
| <%= link_to 'Delete Passenger', | ||
| passenger_path(:passenger_id), | ||
| method: :delete, | ||
| data: { confirm: 'Are you sure?' } %> |
There was a problem hiding this comment.
This link doesn't work! You probably wanted passenger_path(@passenger.
| # use self because we are addressing behavior not attribute. The trip object is passed into the function and then the cost is returned. | ||
| def self.total_cost(input) | ||
| total = input.cost/100 | ||
| return "%.2f"%total |
There was a problem hiding this comment.
I disagree that these should be self methods. I think it is much clearer to say something like
@trip.total_costthan
Trip.total_cost(@trip)| def self.total_cost(input) | ||
| total = input.cost/100 | ||
| return "%.2f"%total | ||
| end |
There was a problem hiding this comment.
You seem to have written this method twice.
| def self.total_earning(trip) | ||
| total = ((trip.cost - (trip.cost * 0.15)) /100) | ||
| return "%.2f"%total | ||
| end |
There was a problem hiding this comment.
Again, you seem to have this method twice. Mis-merge?
| <% if counter == 0 %> | ||
| <%= "Driver does not have a rating yet. " %> | ||
| <% else %> | ||
| <%= "Average Rating: " %><%= average_rating/counter %> |
There was a problem hiding this comment.
This logic is a great candidate for moving to a model method. Instead of keeping a counter and doing math in the view, you ought to be able call @driver.average_rating.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rideshare-Rails
Congratulations! You're submitting your assignment! These comprehension questions should be answered by both partners together, not by a single teammate.
Comprehension Questions