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

Ports - Kate #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Ports - Kate #30

wants to merge 2 commits into from

Conversation

goblineer
Copy link

@goblineer goblineer commented Feb 19, 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? When I started, I had dates at the top level. That became a mess quickly because it required more layers than was really reasonable. Each method had to do too much work and retrieving the data from the nested structure was such a long string that my code was hard to follow. Eventually, I settled on trips as the top layer, but with a nested array of data representing individual trip metrics. I did that because it felt intuitive to put the metrics that change for each trip on a separate layer than the data that does not change as dynamically, like the driver and the date. My sense is that it makes the trips easier to compare and manipulate in relation to one another without using complicated methods to search a hash for the driver_id value or date each time.
What was your strategy for going through the data structure and gathering information? I created methods to bridge the gap between what I had (data) and what I wanted (organized output). The result of the method calls was a transformed structure, a hash containing each driver in order of driver_id paired with a hash containing the totals for the three metrics I would need in the output. Once all of the totals were in the same hash and associated with the driver_id, I was able to iterate over that hash in a single loop to retrieve and print the totals for each driver to the console. Additionally, the loop contains the code for identifying the highest/maximum values and assigning those values along with the associated driver_id to variables defined outside of the loop. That made it quite simple to then print those to the console.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? The maximums/bests were stored to variables because they may well change with each loop through the data. It also was necessary so that I didn't have to iterate through the data more than necessary since I was able to use the same loop to accomplish all of the retrievals.
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 a cascade of .each loops to pare the dataset down into totals for each driver. A .map loop would have been a good choice in the method that creates an array of driver_ids and in any other place where an array of transformed values was desireable.
Were some calculations easier than others? Why? Calculating the average rating took an extra step beyond the other calculations, but it was still relatively simple. I think that my (possibly insane) data transformation extravaganza gave me a hash to work with where the calculation was basically already done before I even thought about output. The top earner calculation also required an extra variable assignment to contain a stored key-value pair, so again, there were extra steps there.

@goblineer goblineer changed the title PORTS - Kate Ports - Kate Feb 19, 2019
@droberts-sea
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

Good job overall! While I've left a few inline comments below, your code works well and it is clear to me that the learning goals around working with enumerables and complex data structures were met. Keep up the hard work!

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