Open
Conversation
…lso the trip_test
…l_revenue method and test)
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...?)
SummaryNice work, you hit all the learning goals here. Nice work on waves 1-3 especially the tests. |
CheezItMan
reviewed
Mar 2, 2020
| @trips.each do |trip| | ||
| total_rating += trip.rating | ||
| end | ||
| return (total_rating / @trips.length).round(2) |
There was a problem hiding this comment.
Suggested change
| return (total_rating / @trips.length).round(2) | |
| return (total_rating / @trips.length.to_f ).round(2) |
| if trip.cost >= 1.65 | ||
| total_revenue += ((trip.cost - 1.65) * 0.80) | ||
| # QUESTION | ||
| elsif trip.cost < 1.65 |
There was a problem hiding this comment.
You don't need the elsif since this is the exact opposite of the if.
Suggested change
| elsif trip.cost < 1.65 | |
| else |
Comment on lines
+87
to
+88
| start_time: Time.parse(record[:start_time]), | ||
| end_time: Time.parse(record[:end_time]), |
|
|
||
| def request_trip(passenger_id) | ||
|
|
||
| available_driver = find_frist_driver |
There was a problem hiding this comment.
spelling? frist?
Suggested change
| available_driver = find_frist_driver | |
| available_driver = find_first_driver |
|
|
||
|
|
||
| # Helper method | ||
| def find_frist_driver |
There was a problem hiding this comment.
Suggested change
| def find_frist_driver | |
| def find_first_driver |
|
|
||
| it "Returns total revenue across all their trips" do | ||
| #Assert | ||
| expect(@driver.total_revenue).must_be_close_to 9.28, 0.01 |
| @@ -132,5 +133,58 @@ | |||
|
|
|||
| describe "total_revenue" do | |||
There was a problem hiding this comment.
You should also have tests for creating a driver with invalid arguments.
| expect(passenger.net_expenditures).must_be_instance_of Float | ||
| end | ||
|
|
||
| it "returns the correct net expenditures and total time spent if the passenger's trip is still in-progress" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assignment Submission: OO Ride Share
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection
CsvRecordand we have subclasses,Passenger,DriverandTrip.TripDispatcher and Driver&TripDispatcher and Passenger&TripDispatcher and Triphave also one to many relationships.available_driversarray withsorted tripsinside of the available drivers. We made a decision based on the test results by using "puts" and rubber ducking each other.self.from_csvinCsvRecordclass. We implemented this method inDriver&Passenger&Tripclasstrip_dispatch_test, we wrote a nominal test called "Selects an available driver and switch to an unavailable status" to make sure we have the correct status for each driver.driver_test, we wrote a edge case called "Returns the correct total revenue when the cost of a trip was less that $1.65" to handle the total revenue calculating the 80% of trip cost without subtracting the fee ($1.65)Inheritance (super class and subclasses)andobject compositions. It was very helpful for us to have diagrams to understand the (is a / has a) relationships . We were very glad to see the usefultemplate methods, and learn when to usehelper methods. Furthermore, we gained more clarity on how to usebeforeblocks, nominal and edge cases in test files.