Skip to content

Sockets - Nidhi#39

Open
nidhiparixitpatel wants to merge 1 commit intoAda-C11:masterfrom
nidhiparixitpatel:master
Open

Sockets - Nidhi#39
nidhiparixitpatel wants to merge 1 commit intoAda-C11:masterfrom
nidhiparixitpatel:master

Conversation

@nidhiparixitpatel
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 I had an array of hashes and then, I played around with a hash of hashes. I was trying to figure out what set up would be best for pulling information with the methods and tools I know and what would make the date readable to someone looking at my code.
What was your strategy for going through the data structure and gathering information? I used the map method several times, even a map method inside of a map method. I also used each and a loop to iterate through each array of hashes in the larger ride_share array. To me, it made sense to organize it so that each driver was in the ride_share array ordered by driver ID and then each driver had an array ordered by date which contained a hash of each ride and the cost, rating, rider id.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? I stored several things in a variable. For example, I used a variable called rating_sum which was an array of each driver's total rating sum. I then used that variable to find the average rating of each driver. It was useful to store this in a variable because it helped to break down the question of finding the average into two parts. First, find the sum, then divide by total number of rides.
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? Yes, I used each, while, and map. Map was super useful, especially in finding the average rating for the drivers. I used map inside a map method to find the rating sum for each driver by iterating through each driver and then ride to find the sum total of their ratings.
Were some calculations easier than others? Why? Yes, it was easier to find the number of rides each driver did because that was also the length of the array for each driver. The other questions did not have such a direct answer.

@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 - good variable names
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! Your code is clear and easy to read, 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!

ride_share = [
DR0001 = [{driver_id: "DR0001", date: "3rd Feb 2016", cost: 10, rider_id: "RD0003", rating: 3 },
{driver_id: "DR0001", date: "3rd Feb 2016", cost: 30, rider_id: "RD0015", rating: 4 },
{driver_id: "DR0001", date: "5th Feb 2016", cost: 45, rider_id: "RD0003", rating: 2 }

Choose a reason for hiding this comment

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

This syntax is probably not doing what you expect. When you say DR001 = ..., you're creating a constant named DR001, in addition to adding a value to the ride_share array. You could omit the DR001 = and your code would work the same way.

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