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

Kat F. & Leanne R. Ride Share OOD #12

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

Conversation

leannerivera
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? putting new classes in separate files, making sure that the lines are in correct order...
Describe any examples of composition that you encountered in this project, if any Putting the classes in the modules as a namespace is an example of composition
Describe the relationship between User and Driver Driver is a subclass of User
Describe a nominal test that you wrote for this assignment. Making sure that new Driver is an instance of Driver class
Describe an edge case test that you wrote for this assignment making sure that VIn is no less or greater than 17 characters
Describe a concept that you/your pair gained more clarity on as you worked on this assignment spec tests
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?

@leannerivera
Copy link
Author

Our recent commits aren't showing up though we had pushed them multiple times...

@CheezItMan
Copy link

@leannerivera Come by and show me what's happening and we can look for your missing commits.

@CheezItMan
Copy link

Ride Share

What We're Looking For

Feature Feedback
Baseline
Used Git Regularly Good number of commits, and mostly good commit messages, you don't need to reference waves in the commit messages. Instead just describe functionality added.
Answer comprehension questions Check
Wave 1
Appropriate use of Ruby's Time Check
Trip has a helper method to calculate duration Done, but awkwardly so. See my inline notes.
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 Yes, but see my notes regarding wave 3
Driver has method to calculate net expenditures and it uses super It's there with a weird class variable when it could use super
Driver has a method to calculate total revenue Check, but see my notes for wave 3.
Tests for wave 2 Some broken tests, instances of Trip missing end_time or start_time.
Wave 3
TripDispatcher has a new method to create trips The method i started, but not complete
creating a trip in TripDispatcher relies on methods in Driver and User (passenger) to modify their own attributes Check
Complex logic was correctly implemented Nope
Tests for request_trip You do have some tests here
Methods from wave 1 and 2 handle incomplete trips Nope
Tests for wave 1 and 2 methods with incomplete trips Nope
Overall There's a lot not working here. Mostly tests that were already broken not corrected. You also have some methods with bugs or errors. I have left notes inline in your code. You definitely need more practice with the nested data structures.

def average_rating
ratings = 0
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.

You should have something added to deal with incomplete trips

completed_trips = @driven_trips.select {|trip| trip.end_time != nil }

And then only use the completed_trips.

The same concept can apply to average_rating, total_revenue etc

count += 1
end

if ratings = 0 || count = 0

Choose a reason for hiding this comment

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

Look at this if statement.

  1. You're using = not ==
  2. This doesn't seem to serve much of a purpose.


total_revenue += (trip.cost - 1.65)
end
return (total_revenue/ 0.8).round(2)

Choose a reason for hiding this comment

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

You're increasing the total revenue by 1.25 times?

def net_expenditures
trip_costs = 0
# driver/passenger trip cost - total_revenue
if TripDispatcher.trips.passenger == self.id

Choose a reason for hiding this comment

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

What is this doing?

You can use the superclass method in this:

return super - self.total_revenue

"PassengerID=#{passenger&.id.inspect}>"

def trip_to_seconds
midnight = Time.local(2018,8,26,0,0,0)

Choose a reason for hiding this comment

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

This could also be done as:

return end_time - start_time


def net_expenditures
total = 0
self.trips.each do |trip|

Choose a reason for hiding this comment

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

For wave 3 you would need to adapt this to incomplete trips.

completed_trips = self.trips.select { |trip| trip.end_time != nil }

end

def total_time_spent
@passenger.trips.each do |trip|

Choose a reason for hiding this comment

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

For wave 3 you would also need to filter the list for only completed trips

@passenger.trips.each do |trip|
t1 = Time.parse(trip.start_time)
t2 = Time.parse(trip.end_time)
duration += sprintf("%0.02f", (t2 - t1) % 60)

Choose a reason for hiding this comment

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

This should return a number, not a string.


it "changes driver status to unavailable" do
request = @dispatcher.request_trip(6)
expect(request.driver.status).must_equal :UNAVAILABLE

Choose a reason for hiding this comment

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

You should also verify the driver was available before the request_trip

end

it "raises an error if there are no available drivers" do
dispatcher = RideShare::TripDispatcher.new(USER_TEST_FILE,

Choose a reason for hiding this comment

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

smart 👍

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