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

Update worksheet.rb #34

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

Update worksheet.rb #34

wants to merge 2 commits into from

Conversation

beauttie
Copy link

@beauttie beauttie 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? At first, the third layer of my data structure had a hash for each ride, but I noticed that multiple rides occurred on the same day for DR0001, so I included an array as the value for the keys of cost, rider_id, and rating to represent those characteristics of a ride in an element.
What was your strategy for going through the data structure and gathering information? My strategy was calling on each element of a layer in the terminal and going through an example with one ride on paper.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? Storing the number of rides, earnings, and average rating for each driver into a variable was useful because I used that data structure to summarize the data using a method.
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 the .each iterator throughout my code and the .map iterator in line 120.
Were some calculations easier than others? Why? Summarizing the data was harder than aggregating it because I took time to think about how I wanted to pull and organize a subset of the data.

@beauttie beauttie closed this Sep 14, 2020
@beauttie beauttie reopened this Sep 14, 2020
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 ✔️
... outputs which driver has the highest average rating ✔️

Overall Feedback

Great work on this assignment! Your code is readable, logical, and it is clear that the learning goals around working with nested data structure were met. It is particularly noteable that you used one main loop to calculate all the relevant driver statistis. I've left a few inline comments for you to review. One additional thought to consider is encapsulating some of your functionality into a method, though it is not necessary with this program since the functionality is not used more than once. Keep up the hard work!

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
Elegant/Clever
Descriptive/Readable
Concise
Logical/Organized

@@ -23,12 +38,135 @@
# into this data structure, such as "DR0004"
# and "3rd Feb 2016" and "RD0022"

drivers_data = {

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.

Comment on lines +127 to +128
ride[:cost].each { |ride_cost| earnings += ride_cost }
ride[:rating].each { |ride_rating| sum_rating += ride_rating }

Choose a reason for hiding this comment

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

This is very clear! You could consider using the .reduce enumerable for these operations.

# map outputs an array
# p drivers_rides

drivers_rides.each do |nested_hash|

Choose a reason for hiding this comment

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

Consider giving nested_hash a more meaningful name

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