Open
Conversation
Ride ShareWhat We're Looking For
Summary | I would suggest writing methods to do the calculations, breaking up your code into modules, but what you have is fine. You made good use of ennumerables. Well done. |
CheezItMan
reviewed
Feb 25, 2019
| info = [ | ||
| { | ||
| driver: ["DR0001"], | ||
| rider: ["RD0003", "RD0015", "RD0003"], |
There was a problem hiding this comment.
Note, by making each element's hash containing a series of parallel arrays, your code becomes a bit more fragile and harder to read. That's because it depends on the order of the rider id and date and cost and rating to stay aligned for this to work. It does here, but could make the code harder to maintain.
| }, | ||
| ] | ||
| # Iterated through the info i need to answer the specific questions in the prompt. Used .map to create a new array with the computed info to answer the ?s. | ||
| computed_infos = info.each_with_index.map do |driver_info, i| |
There was a problem hiding this comment.
Clever setting up a hash with the calculated info.
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?