-
Notifications
You must be signed in to change notification settings - Fork 49
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
Create leaves - cloudy #49
base: master
Are you sure you want to change the base?
Conversation
Ride ShareWhat We're Looking For
|
def driver_info | ||
drivers_info = { | ||
DR001: [ | ||
{date: "2016-02-03", cost: 10, rider_id: "RD0003", rating: 3}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This formatting is exceptionally clear!
puts "The total earnings per driver is: " | ||
total_earnings = ride_rating_totals(:cost) | ||
total_earnings.each do |driver, value| | ||
puts "Driver #{driver}: #{value} dollars" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate that you are separating calculations from communication with the user! This is a good practice for MVC in rails!
puts "Driver #{driver}: #{trips.length} rides" | ||
end | ||
|
||
def ride_rating_totals(key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does more than the rating totals at this point. Could you have renamed it to make your intention clearer?
|
||
|
||
def driver_info | ||
drivers_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would have liked to see you passing around the drivers_info
variable, rather than using a method that generates it each time.
ride share
Congratulations! You're submitting your assignment.
Comprehension Questions
.map
? If so, when? If not, why, or when would be a good opportunity to use it?end |
| Were some calculations easier than others? Why? | yes, some were easier and others that were inside of a hash inside an array |