-
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
Space - Cathy #24
base: master
Are you sure you want to change the base?
Space - Cathy #24
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...?)
|
@@ -0,0 +1,147 @@ | |||
# create drivers {hash} as a single variable data structure |
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.
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) |
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.
Really nice use of methods!
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is clear, concise and I love it!
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?