Open
Conversation
Ride ShareMajor Learning Goals/Code Review
Functional Requirements
Overall Feedback
Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
SummaryNicely done, you hit the learning goals here. I like how you organized things into methods. However there are a few things to look at here. |
CheezItMan
reviewed
Feb 13, 2020
Comment on lines
+129
to
+131
| each_money = sum_drivers_income(drivers) | ||
| most_made = each_money.max_by { |driver, earnings| earnings }[0] | ||
| puts "This driver: #{most_made} made the MOST money!" |
|
|
||
| highest_rated = [highest_avg_rating(drivers)].to_h | ||
| highest_rated.each do |driver, rating| | ||
| puts "The highest average rating of: #{rating} belongs to this driver: #{driver}!" |
Comment on lines
+120
to
+121
| total_income_for_each_driver.each do |driver, income| | ||
| puts "This driver: #{driver} made this much money: $#{income}" |
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.
Assignment Submission: Ride Share
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection
| What was your strategy for going through the data structure and gathering information? | Mostly .each and nested loops. Start with the most outer data structure - ask myself - is this what I need? If no, then I had to go a level deeper. |
| What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? |
The result of the method sum_drivers_income was necessary to be store in a variable so I could eventually find the driver who made the most money. |
| What kinds of iteration did you use? Did you use
.map? If so, when? If not, why, or when would be a good opportunity to use it? |I used .each and then used .sum and .max_by. I know that .map returns an array and I was building hashes. | I need a lot more practice using with nested data structures and enumerables.
| Were some calculations easier than others? Why? |
Yes. Finding how many rides each driver did was easiest because it was only one level deep. Finding the highest average rating was more complicated as it was several layers deep - which for me - can be a bit abstract.