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 #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

KayKay-git
Copy link

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? It looks similar to what it looks like now. I thought and wrote out the plan beforehand using the guiding questions, as well as the assignment questions. In the beginning, I thought of adding an extra hash layer to store ride information by rider ID, but this complicated the structure unnecessarily, and decided to keep all of the trip information data together.
--- ---
What was your strategy for going through the data structure and gathering information? My first step was to determine what information I would need to answer the question, the next step was to recognize which layer it was in and its corresponding data type to ensure I was iterating through the data correctly. I tested my thinking with simple one-line codes to determine if my thoughts on accessing the specific data were right. Once that was clear, it was about deciding which methods were the best option.
--- ---
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? I created a variable to store the average rating and the total amount each driver made. This was necessary since the last two questions pertain to finding who made the most money and had the highest rating. By already having a variable with this information, I can quickly iterate through it and pick out the highest values.
--- ---
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 mainly used the .each method. I did not use the .map method. Using the .each method did add an extra step of shoveling values into an array but I found it helped me visualize my program better so I still chose it. The map method is beneficial when you want to return an array and avoid this extra step.
--- ---
Were some calculations easier than others? Why? I found the last two questions to be the most involved as they needed more steps and required iterating through the deepest parts of the data structure. For example, when finding the number of rides each driver has given, it only required iterating through the first layer of the data structure. The same can be said of calculations to find which driver had earned the most or had the highest rating. In order to do that, I needed to compare data between drivers, which is more involved.

Copy link

@dHelmgren dHelmgren 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 ✔️ see note!
... outputs which driver made the most money ✔️
... outputs which driver has the highest average rating ✔️

Overall Feedback

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

Quality Yes?
Descriptive/Readable
Concise

total_rating = trips.sum do |item|
item[:rating]
end
avg = total_rating/trips.length

Choose a reason for hiding this comment

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

So the averages you are giving are rounding to the nearest whole number because of how you are doing the math. remember, in a situation like this, a .to_f on either the length or total_ratings would go a long way to preserving data.

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