-
Notifications
You must be signed in to change notification settings - Fork 54
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 #46
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 | It looks like you added a drive for Driver 4, but given this, all your calculations are correct! |
... 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. You worked through some tricky logic and clever ways, and practiced using enumerable methods.
It can be hard to find a balance between encapsulating functionality in individual methods, and using a single method to perform multiple calculations. We will keep practicing this and seeing examples.
Great work on formatting your output in a way that is very readable. 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 | ✅ |
# - Which driver has the highest average rating? | ||
|
||
ride_log = { DR0004: [["3rd Feb 2016",5,"RD0022",5], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider storing each individual trip as a hash rather than an array. For example
{date: "3rd Feb 2016", cost: 5, rider: "RD0022", rating: 5}
This will increase readability and make it so you don't need to rely on knowing which column the data is stored in, but can use the keys to index the values you need.
end | ||
|
||
def rides_each_driver(log) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work breaking up the functionality into different methods and giving each method a meaningful name. Consider also giving all variables meaningful names to increase readability. Consider what you're storing in big_array
and what would be an appropriate name.
puts total_each_driver(ride_log) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these two methods both calculate totals for drivers, it might simplify and speed up your code to combine this functionality into a single method.
Assignment Submission: Ride Share
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection
.map
? If so, when? If not, why, or when would be a good opportunity to use it?