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...?)
|
dHelmgren
reviewed
Feb 13, 2020
| @@ -0,0 +1,147 @@ | |||
| # create drivers {hash} as a single variable data structure | |||
There was a problem hiding this comment.
Hey, small thing, but the name of this file made things tricky!
you named the file using spaces, which meant I couldn't easily run it from the command line, and you also forgot to make the file type .rb. Not a huge deal, and might not come up again, but I figure it's good to know.
| end | ||
|
|
||
| # create a method to sum up money made each day per driver and get the date they made the most money | ||
| def get_max_money_date(array_entered) |
Comment on lines
+130
to
+142
| organized_data.length.times do |i| | ||
| puts "Driver #{organized_data[i][:driver_id]} has given a total of #{organized_data[i][:total_rides]} rides" | ||
| puts "Driver #{organized_data[i][:driver_id]} has made a total of $#{organized_data[i][:total_money]}" | ||
| puts "Driver #{organized_data[i][:driver_id]} has an average rating of #{organized_data[i][:avg_rating]}" | ||
| end | ||
|
|
||
| # find which driver made the most money using an enumerable and generate result | ||
| max_money = organized_data.max_by{|each_hash| each_hash[:total_money]} | ||
| puts "The driver that made the most money with $#{max_money[:total_money]} is #{max_money[:driver_id]}" | ||
|
|
||
| # find which driver had highest rating using an enumerable and generate result | ||
| max_rating = organized_data.max_by{|each_hash| each_hash[:avg_rating]} | ||
| puts "The driver that has the highest average rating of #{max_rating[:avg_rating]} is #{max_rating[:driver_id]}" |
There was a problem hiding this comment.
This section is clear, concise and I love it!
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
.map? If so, when? If not, why, or when would be a good opportunity to use it?