Skip to content
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

Create leaves - cloudy #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Create leaves - cloudy #49

wants to merge 1 commit into from

Conversation

OhCloud
Copy link

@OhCloud OhCloud commented Aug 12, 2019

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? Driver Info is wrapped in a method, which is in a hash, with an array that has hashs of trips.
What was your strategy for going through the data structure and gathering information? to iterate through
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? all driver info is inside a variable to be called later.
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? puts "The number of rides each driver has given is:"
driver_info.map do driver, trips
puts "Driver #{driver}: #{trips.length} rides" 

end |
| Were some calculations easier than others? Why? | yes, some were easier and others that were inside of a hash inside an array |

@dHelmgren
Copy link

Ride Share

What We're Looking For

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

def driver_info
drivers_info = {
DR001: [
{date: "2016-02-03", cost: 10, rider_id: "RD0003", rating: 3},

Choose a reason for hiding this comment

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

This formatting is exceptionally clear!

puts "The total earnings per driver is: "
total_earnings = ride_rating_totals(:cost)
total_earnings.each do |driver, value|
puts "Driver #{driver}: #{value} dollars"

Choose a reason for hiding this comment

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

I appreciate that you are separating calculations from communication with the user! This is a good practice for MVC in rails!

puts "Driver #{driver}: #{trips.length} rides"
end

def ride_rating_totals(key)

Choose a reason for hiding this comment

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

This does more than the rating totals at this point. Could you have renamed it to make your intention clearer?



def driver_info
drivers_info = {

Choose a reason for hiding this comment

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

I think I would have liked to see you passing around the drivers_info variable, rather than using a method that generates it each time.

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