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

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

Conversation

RachaelGomez
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? My data structure was at first just one array with several hashes organized by dates and rides. However, with time I found it easier to have a separate array with driver ids that were organized and rid of duplicates and I used this array frequently in my code
What was your strategy for going through the data structure and gathering information? By having the array with just the driver ids, it was easier to iterate through the larger data structure by checking for ids that matched the ids that were in the array and organized by number
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? my total money function was then stored in a variable so I could access it more easily when I needed the total for the max value function.
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 lot of .each but didn't use .map .map probably would've been useful when I was creating some array out of the info but I didn't see a good and simple use for it.
Were some calculations easier than others? Why? getting the max calc was easy after all of the other calculations were finished because of the method that is built into ruby.

Copy link

@kaidamasaki kaidamasaki left a comment

Choose a reason for hiding this comment

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

The way you broke the problem down into pieces was good but you had some trouble with the execution.

Going forward if you should focus on asking yourself "what if I had to deal with more data, or an unknown amount of data?" and focus on making sure that your program can grow to accommodate that.

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 You used integer math here instead of floating point math.
... 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

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

Comment on lines +62 to +79
dr_two_trips = 0
dr_three_trips = 0
dr_four_trips = 0

rides.each do |hash|
hash.each do |key, value|
if value == "DR0001"
dr_one_trips = dr_one_trips + 1
elsif value == "DR0002"
dr_two_trips = dr_two_trips + 1
elsif value == "DR0003"
dr_three_trips = dr_three_trips + 1
elsif value == "DR0004"
dr_four_trips = dr_four_trips + 1
end
end
end

Choose a reason for hiding this comment

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

You should avoid creating separate variables for things like this. Imagine what this would look like if you had to handle 100 drivers, or 1000, or all of the drivers that an actual company had.

Instead using an Array or Hash here would make things cleaner and more scalable.

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