Conversation
…d tests for both, passed tests
…assenger,trip,tripdispatch. uncommented driver test.
…Trip tests to pass
…d_driver and add_trip method in driver class. updated connect method in trip class. test for add_trip for driver passed
…atcher, added tests and passed
beccaelenzil
left a comment
There was a problem hiding this comment.
Good work overall. You've met the learning goals around working with a large existing coding base and working with classes using composition and inheritance. I've left a few comments for you to review. Your tests could be a bit more thorough accounting for edge cases for instances where there are no trips or trips in progress. Keep up the hard work!
| @passenger.add_trip(trip2) | ||
| end | ||
|
|
||
| it "will calculate the total time spent on their trips" do |
There was a problem hiding this comment.
You should also test the edge case of a passenger having no trips.
| @trips << trip | ||
| end | ||
|
|
||
| def average_rating |
There was a problem hiding this comment.
Driver and Passenger methods should handle incomplete trips.
Both these methods will hit an error if you try to run them on a user with an incomplete trip. There are a couple of workarounds for this.
You could explicitly ignore trips with a nil cost:
trips.each do |trip|
if trip.cost.nil?
next
end
# ... add to the total ...
endOr even better, you could write a helper method that returns a list of complete trips:
def completed_trips
return @trips.reject { |t| t.end_time.nil? }
end
def net_expenditures
completed_trips.each do |trip|
# ... same logic as before ...
end
end
OO Ride ShareMajor Learning Goals/Code Review
Testing Requirements
Overall Feedback
Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
|
Assignment Submission: OO Ride Share
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection