-
Notifications
You must be signed in to change notification settings - Fork 48
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
Time - Alicia #29
base: master
Are you sure you want to change the base?
Time - Alicia #29
Conversation
Ride ShareMajor Learning Goals/Code Review
Functional Requirements
Overall Feedback
Your code was pretty solid aside from not defining your own methods. I especially like how you made such good use of Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
|
# The total amount of money each driver has made | ||
drivers_earnings = {} | ||
drivers_rides_data.each do |driver, rides_array| | ||
total_money = rides_array.reduce(0) { |sum, ride| sum + ride[:COST] } |
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.
.reduce
is really cool and powerful but you can use .sum
for simple things like this if you'd like.
total_money = rides_array.sum { |ride| ride[:COST] }
|
||
|
||
# Which driver made the most money? | ||
top_earner = drivers_earnings.reduce([0, 0]) do |best, (driver, earnings)| |
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.
Nice use of .reduce
here.
Assignment Submission: Ride Share
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection
.map
? If so, when? If not, why, or when would be a good opportunity to use it?