Skip to content

CloudyLopez#44

Open
CloudyLopez wants to merge 2 commits intoAda-C11:masterfrom
CloudyLopez:master
Open

CloudyLopez#44
CloudyLopez wants to merge 2 commits intoAda-C11:masterfrom
CloudyLopez:master

Conversation

@CloudyLopez
Copy link

ride share

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What did your data structure look like at first? Did this structure evolve over time? Why? At first it was way more hard coded, it evolved into a cleaner, nicer code.
What was your strategy for going through the data structure and gathering information? I read the instructions many many times. i then recreated the data in a way that was easy to read and began that way. (creating info based on drivers.)
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? hashes of arrays on hashes and arrays etc
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 have notated when i would use .map tho it did not work the way i wanted it too. :/
Were some calculations easier than others? Why? bc some calculations take longer than others to create (i'm looking at your avg)

@CloudyLopez CloudyLopez changed the title Create a_worksheet.rb CloudyLopez Feb 19, 2019
@tildeee
Copy link

tildeee commented Feb 27, 2019

Ride Share

What We're Looking For

Feature Feedback
Answers the comprehension questions x
Readable code with consistent indentation and reasonable code style x
Outputs the correct number of rides each driver has given x
Outputs the total amount of money each driver has made x
Outputs the average rating for each driver x
Outputs which driver made the most money x
Outputs which driver has the highest average rating x

Hi Cloudy!

Your code looks GREAT! It is clean, readable, and logical. I understand exactly where you came from and where you are going in your code. It answers the questions accurately and it's presented in a really wonderful way.

Overall, your code is exactly what I'm looking for... And I'm so excited, because if it gets pushed one more level deeper, it will get to where I want it to be. And by that, I mean the one following specific thing: I'd like to see finding the drivers information in a loop.

Your code has the following things:

driver1_rides = drivers_db[:DR001]
driver2_rides = drivers_db[:DR002]
driver3_rides = drivers_db[:DR003]
driver4_rides = drivers_db[:DR004]

allrides = [driver1_rides, driver2_rides, driver3_rides, driver4_rides]

You found EXACTLY what you needed to find: the rides for each driver, and then you put them into an array of allrides. You clearly understand what data structures you needed to make and how to make them. You even use allrides in the way I am looking for (by using a loop):

allrides.each_with_index do |rides, i|
    puts "Driver ##{i+1} #{rides.length} rides"
end

If you can change your code so that allrides is the value of an array that holds all of the driver information without needing to make 4 different variables (driver1_rides, driver2_rides, etc.) then that would push this project to exactly where I want you to be.

That being said, like I mentioned before, your code is not a mess: it's logical, it's clear, and it's efficient. Well done on those accounts-- your syntax is all right, your code is all good-looking, it's just missing that one step of going from hard-coded driver data to full-on iteration for each step.

# puts "#{driver2_rides.length} rides"
# puts "#{driver3_rides.length} rides"
# puts "#{driver4_rides.length} rides"
allrides = [driver1_rides, driver2_rides, driver3_rides, driver4_rides]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very small nitpick but: to follow Ruby naming conventions more closely, allrides should be all_rides

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants