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

Addy - Goeun - Edges - OO Ride Share #14

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Conversation

goeunpark
Copy link

OO Ride Share

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a design decision you had to make when working on this project. What options were you considering? What helped you make your final decision? We decided we didn’t need a helper method in User for Wave 3 to add the in-progress-trip because it would be the same code as add_trip method. We also decided to return a nil if there are no available drivers. We thought about returning a string (but made our code WET) or ArgumentError (but it felt more like a probable edge case than a programming error) but decided nil made most sense.
Describe any examples of composition that you encountered in this project, if any Trip is an object that is called frequently in TripDispatcher, User, and Driver but it is not worked in as an inherited class. A Trip loaded or added as its own object and can be used dynamically.
Describe the relationship between User and Driver Driver is a subclass of User. User keeps an array all trips a User takes as a passenger and Driver keeps an array of all trips a User drives. The array that stores all the hashes of each trip a user rides as a passenger will also contain IDs of the driver of each trip, while the inverse is true for the Driver subclass, that the hashes stored in the array of driven trips will have an passenger ID that links to the User class.
Describe a nominal test that you wrote for this assignment. In Driver class we wrote a test to test that the total revenue method will go through a driver’s driven trips, and sum the cost of all of the trips, subtract the appropriate fees, and assign the driver their commission, then divide by the array’s length. This should return a Driver’s total revenue. This test is nominal because it is a basic function of the method that we expect it to perform every time.
Describe an edge case test that you wrote for this assignment An edge case for the above example is that we created tests to test if any of the driven trips in the above method have the rating value nil. This would mean that the trip is currently in transit and would cause adding errors, so we created a conditional to test and count all trips that had a cost of nil, which would ignore the nil in the addition calculation and then subtract the count of nils from the length of the driven trips array in the final calculation. This is an edge case because it tests the boundary of the method beyond its core purpose.
Describe a concept that you/your pair gained more clarity on as you worked on this assignment We learned how to write better unit tests! We got more comfortable using super to pass in User functionality in Driver. We gained a better understanding of the relationship between parent and child classes as well as composition relationships. We know how to raise ArgumentErrors better now! We feel pretty good about reading csv files!
What are two discussion points that you and your pair discussed when giving/receiving feedback from each other that you would be willing to share? We are both great and we both had a good time and we were great at supporting and communicating with each other! We solved many MethodErrors and bugs and it was good to be in the same space / motivate each other when things weren’t working.

addisoncole and others added 30 commits August 27, 2018 15:45
…thod to test that start time is before end time.
…r to link trips to a drive during Load Trips method
…ivers trips after taking into the trip cost and rideshare cost
@CheezItMan
Copy link

Ride Share

What We're Looking For

Feature Feedback
Baseline
Used Git Regularly Good number of commits and good commit messages
Answer comprehension questions Check, glad you worked together well and that you learned better testing
Wave 1
Appropriate use of Ruby's Time Check
Trip has a helper method to calculate duration Check
User (passenger) has a method to calculate total cost of all trips Check
Tests for wave 1 Check
Wave 2
Driver inherits from User Check
Driver has add_driven_trip method Check
Driver has method to calculate average rating Check
Driver has method to calculate net expenditures and it uses super Check
Driver has a method to calculate total revenue Check
Tests for wave 2
Wave 3
TripDispatcher has a new method to create trips Check
creating a trip in TripDispatcher relies on methods in Driver and User (passenger) to modify their own attributes Check
Complex logic was correctly implemented Check
Tests for request_trip Check
Methods from wave 1 and 2 handle incomplete trips Check
Tests for wave 1 and 2 methods with incomplete trips Check, well done
Overall Great work, you both hit the learning goals for the project. Nice work with your testing and handling incomplete trips. See my notes for ways to do things more compactly. Nicely done.

end
end

def add_trip(trip)

Choose a reason for hiding this comment

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

Since this method does exactly the same as User's version of add_trip so you can just leave the method out.


rating = 0.0
nil_count = 0
@driven_trips.each do |trip|

Choose a reason for hiding this comment

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

This works, but you can also use select to filter out incomplete trips.

return ((total_revenue - (1.65 * (@driven_trips.length - nil_count))) * 0.8)
end

def net_expenditures

Choose a reason for hiding this comment

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

👍

#{passengers.count} passengers>"
end

def find_available_driver

Choose a reason for hiding this comment

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

Well done, good helper method!

it "intializes the trip with cost, rating and end time set as nil" do
trip = @dispatcher.request_trip(1)

expect(trip.cost).must_be_instance_of NilClass

Choose a reason for hiding this comment

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

You could also simply use

expect(trip.cost).must_be_nil

@trip = RideShare::Trip.new(@trip_data)
end

it "calculates the duration of trip in seconds" do

Choose a reason for hiding this comment

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

You should also test incomplete trips.

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.

3 participants