Conversation
beccaelenzil
left a comment
There was a problem hiding this comment.
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? No newline at end of file | ||
| # - Which driver has the highest average rating? | ||
|
|
||
| ride_log = { DR0004: [["3rd Feb 2016",5,"RD0022",5], |
There was a problem hiding this comment.
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.
| "$#{'%.2f' % num}" | ||
| end | ||
|
|
||
| def rides_each_driver(log) |
There was a problem hiding this comment.
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 rides_each_driver(ride_log) | ||
| puts total_each_driver(ride_log) |
There was a problem hiding this comment.
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?