Skip to content

Create leaves - cloudy#49

Open
OhCloud wants to merge 1 commit into
Ada-C12:masterfrom
OhCloud:patch-1
Open

Create leaves - cloudy#49
OhCloud wants to merge 1 commit into
Ada-C12:masterfrom
OhCloud:patch-1

Conversation

@OhCloud

@OhCloud OhCloud commented Aug 12, 2019

Copy link
Copy Markdown

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
Copy Markdown

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

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

Copy link
Copy Markdown

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!

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

Copy link
Copy Markdown

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!

Comment thread leaves - cloudy
puts "Driver #{driver}: #{trips.length} rides"
end

def ride_rating_totals(key)

Copy link
Copy Markdown

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?

Comment thread leaves - cloudy


def driver_info
drivers_info = {

Copy link
Copy Markdown

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