Skip to content

Branches, Kristy #48

Open
kristyh32 wants to merge 1 commit intoAda-C12:masterfrom
kristyh32:master
Open

Branches, Kristy #48
kristyh32 wants to merge 1 commit intoAda-C12:masterfrom
kristyh32:master

Conversation

@kristyh32
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 my data structure was an array of hashes of arrays of hashes. I decided that it was simpler to access the data if I got rid of the outermost array and just had a hash of arrays of hashes.
What was your strategy for going through the data structure and gathering information? I used an each loop to go through the data and display the information of the current driver in the loop
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? I found it necessary to store the ratings into a variable in order to calculate the average. I also found it useful to store the highest paid and highest rated drivers in variables.
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 used an each loop to iterate over my hash and stored numbers in variables. I did not use .map, but I think I could have used to calculate the comparison questions
Were some calculations easier than others? Why? Yes, the first three calculations were the easiest for me to do. The comparison questions were the hardest for me because of the way my data was structured

@tildeee
Copy link

tildeee commented Aug 20, 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

Good work on this project, Kristy! Overall, your code is clean, logical, and well-organized. You show clear iteration and use of accessing/reading values of nested hashes and arrays.

Overall, I'd say that your variable names did not lead to easily readable code; I found some of them intimidating, and I found myself unable to track what variables represented because of their names! Also, if you had more time on this project, I would love to see how you would refactor to practice making more methods.

That being said, overall your code style looks good (good indentation, vertical space, etc), and your solutions were good. Good work!

driver_earn = ""


drivers.each do |key, value|
Copy link

Choose a reason for hiding this comment

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

Hm, may I suggest renaming these variables to driver and trips, because the key represents the driver, and the value represents an array of trips they've driven?

drivers.each do |key, value|
earnings = 0
score = 0
value.each do |i|
Copy link

Choose a reason for hiding this comment

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

Hm, instead of i, could we rename this variable to trip, since each element represents a trip?

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