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

Rideshare Reflection #42

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

Rideshare Reflection #42

wants to merge 2 commits into from

Conversation

emirry
Copy link

@emirry emirry commented Sep 14, 2020

Assignment Submission: Ride Share

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Question Answer
What did your data structure look like at first? Did this structure evolve over time? Why? My data structure did evolve a little once I got into step 4. There weren't too many changes except for the first hash for DR0001: Instead of 2 separate hashes for "3rd Feb 2016", I had one hash that contained nested a nested array for :rider and :rating (e.g., rider: ["RD0003", "RD0014"] and rating: [3,4]). It got a little confusing for me to iterate through all those layers, so I simplified it and created a separate hash for it instead.

| What was your strategy for going through the data structure and gathering information? | It was easier for me to just focus on one driver to gather information. Honestly, I'm not sure if my thinking is correct, but I broke it down into chunks i.e., understanding which part is the array and the hash. Once I established that it was a little easier to loop through the different layers. |

| What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? | It was important for me to have the variables, total_earned, rating_total, and rating_average to find the total sum/ratings for those drivers. If I didn't have them, I wouldn't be able to store the total earnings for each driver. I also end up repeating total_earned = 0 and rating_total = 0 after the puts statement, because I didn't know another way to reset the total; without repeating it, the next driver's total will add onto the previous driver's total. |

| 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 did not end up using .map nor did I finish answering the last 2 questions. I think it might be a good opportunity to use it to find the total earnings for each driver. I did try cost_value.map instead of each and it still works, but it made me question the difference between the two for my program. I realize I don't fully understand the enumerable when it comes to applying my knowledge. |

| Were some calculations easier than others? Why? | I thought it was easier to calculate the average after I figured out the total earnings for each driver. But I also realized that I'm still struggling with how to combine methods so I left the last 2 questions blank. I'm wondering if I wrote my methods incorrectly because when I try calling my method, sum_money(total_cost) to answer question 4, I run into scoping errors. I think I need to call that method in order to find the maximum earning? I know I need to come back to this assignment and finish it, but I need to review some concepts a little more before doing so. |

Copy link

@beccaelenzil beccaelenzil left a comment

Choose a reason for hiding this comment

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

Ride Share

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Correctly creates, reads, and modifies variables ✔️
Correctly creates and accesses arrays ✔️
Correctly creates and accesses hashes ✔️
Reasonably organizes large amounts of related data into nested arrays and hashes ✔️
Correctly iterates through a nested data structure using loops and/or Enumerable methods ✔️
Reasonably organizes small pieces of code into methods, and calls/invokes those methods ✔️

Functional Requirements

Functional Requirement yes/no
To the terminal, the program outputs the correct number of rides each driver has given ✔️
... outputs the total amount of money each driver has made ✔️
... outputs the average rating for each driver ✔️
... outputs which driver made the most money As noted in your reflection, this was not complete.
... outputs which driver has the highest average rating As noted in your reflection, this was not complete.

Overall Feedback

Good work overall. It is clear that the learning objectives around working with nested data structures was met. I've left some in line comments for you to review focused on designing your methods and naming your parameters. You are very close to answer the final two questions, and I'd be happy to go over them with you!

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 4+ in Code Review && 3+ in Functional Requirements
Yellow (Approaches Standards) 2-3 in Code Review && 2+ in Functional Requirements ✔️
Red (Not at Standard) 0,1 in Code Review or 0,1 in Functional Reqs, or assignment is breaking/doesn’t run with less than 5 minutes of debugging

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Descriptive/Readable
Logical/Organized

# - Which driver has the highest average rating?

driver_records = {

Choose a reason for hiding this comment

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

Great work formatting this data structure for readability.

}

# - the number of rides each driver has given

Choose a reason for hiding this comment

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

It looks like you pass the following three functions driver_records, and thus the parameter should have a name that reflects this.

Choose a reason for hiding this comment

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

On that note, consider combining the following three methods into one to reduce repeated code. You could call it something like calculate_individual_driver_stats. It's a delicate balance between deciding to write many methods so that they each only do one thing and writing fewer methods to reduce repeated code.

rider_review = review[:rating]
rating_total += rider_review
rating_average = rating_total / rating.length

Choose a reason for hiding this comment

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

Note that you used integer division for the average rating, and lost a little precision.

Comment on lines +164 to +165
# - Which driver has the highest average rating?

Choose a reason for hiding this comment

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

You have done all the work above to make answering these questions possible. If you call the methods above for all the drivers, you could collect the data in an array, and then find the max. Let me know if you'd like to go over this!

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