Conversation
Ride ShareWhat We're Looking For
Overall | Nice work on this project. It was clever to write some methods that make the enumerable methods work for you in the context of hashes. You code is clear and readable. The organization of your data structure works well. See one inline comment for a suggestion of how to use the .join method to make your code more succinct. |
Ride ShareWhat We're Looking For
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ride share
Congratulations! You're submitting your assignment.
Comprehension Questions
.map? If so, when? If not, why, or when would be a good opportunity to use it?I used each loops when trying to calculate and store data for each driver and when calculating how much drivers earned on each particular date. And I used each_with_index when trying to convert arrays into grammatically correct strings. I did not use .map in place of the each loop that iterated through the driver data because the content of the loop was very long and I wanted to return more than one piece of information (total earnings and average rating) as their own separate hashes to better take advantage of Ennumerables for later calculations. I also did not use .map in place of the each loop that iterated to find how much each driver made per day because I did not need to perform the same calculation on each element of my array. In some cases where rides occurred on the same day, I needed to add the values of several elements together. Map will preserve the structure of the input.
I could have used .map if I split up my rides.each loop (looping through each driver information) into several sections but it was easier and more intuitive for me to code it as on large each loop instead.