Skip to content

Conversation

@kangazoom
Copy link

Rideshare-Rails

Congratulations! You're submitting your assignment! These comprehension questions should be answered by both partners together, not by a single teammate.

Comprehension Questions

Question Answer
Describe the types of entity relationships you set up in your project and why you set up the relationships that way We said that the Driver has many Trips and that the Passenger has many Trips. We also said that Trips belongs to Driver as well as to Passenger. We set up the relationships this way since trips have one driver and one passenger, but drivers and passengers can each have many trips.
Describe the role of model validations in your application Validations ensure that we are passing good data into the database. In this case, our validations ensure that entries like name, phone number, vin, etc. are present (not empty). Our validations only check for presence--not for any other validation specifications.
How did your team break up the work to be done? We did the initial set up and generations (model, controllers, db, etc.) together. We also did some planning before working on the project. We divvied up the work by Passenger, Driver, Trips, and design work. We then worked on lingering issues together. We utilized branches.
What features did you choose to prioritize in your project, and what features, if any, did you have to set aside to meet the deadline? We prioritized the foundational requirements first before delving deeper into more complex functionalities (such as those that required business logic). We did not get to the “On the trip details page I can: Assign a rating (1-5) to the trip, if it does not already have one” feature, and we wanted to do a bit more clean up / add more detail (ex: forms, deletion redirection for trips, more design, pagination, etc.)
What was one thing that your team collectively gained more clarity on after completing this assignment? Nested routes and how to access methods in the model.
What is your Trello board URL? https://trello.com/b/Izp4Kpuc/michelle-barbara
What is the Heroku URL of your deployed application? https://barchelle-rideshare.herokuapp.com/
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 worked hard on organizing the tasks, and we communicated a lot about the branches, when to merge to master, etc.

kangazoom and others added 30 commits October 1, 2018 16:14
deleted everything in passenger viewer index file
adding passenger_work commits to master
BarbaraWidjono and others added 28 commits October 4, 2018 12:49
Merge master branch with trip_work_create_trip
Merge master to trip_work_create_trip
Merge master with trip_work_create_trip
@droberts-sea
Copy link

Rideshare Rails

What We're Looking For

Feature Feedback
Baseline
Appropriate git usage with no extraneous files checked in and both partners contributing yes
Answered comprehension questions yes
Uses named routes (like _path) yes
RESTful routes utilized some extra / unused routes
Project Requirements
Table relationships These are set up correctly, but in several places you're repeating work that Rails does for you. It would be worth reviewing all the things you get when you set up a model relation.
Validation rules for Models yes
Business logic is in the models mostly - good work
Database is seeded from the CSV files yes
Trello board is created and utilized in project management yes
Heroku instance is online yes
The app is styled to create an attractive user interface yes
Overall

Good work overall. This site's code is well-written and clear. You make good use of validations and model methods, and it's clear to me that the learning goals for this week were met. Aside from the many nitpicks that are inevitable on a project of this size, the two things that I would like you to review are model relations and routing with resources. However, in general I am happy with this submission. Keep up the hard work!


driver_trips = self.trips.where(driver_id: id)
num_of_trips = driver_trips.count

Choose a reason for hiding this comment

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

Line 10 is redundant - self.trips will only return trips for this driver, which means all of them have the correct driver ID.

validates :driver_id, presence: true
validates :passenger_id, presence: true


Choose a reason for hiding this comment

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

The belongs_to relationship should already validate the driver ID and passenger ID, so you do not need to do so explicitly.

def new
@trip = Trip.new
end

Choose a reason for hiding this comment

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

This controller action is not used. The link to request a trip goes directly to the create action, bypassing the new form.

first_avail_driver = all_avail_drivers.first

passenger_id = params[:passenger_id]
@trip = Trip.new(

Choose a reason for hiding this comment

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

All of the work done in this method could be moved to a model method. An instance method on Passenger would probably work well, something like Passenger#request_trip.

Note that you can call methods of one model from another model, so Passenger#request_trip could call Driver.where(available: true).

@@ -0,0 +1,21 @@
<%= action_title %>

<%= form_with model: @driver do |f| %>

Choose a reason for hiding this comment

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

I'm glad you're using a view partial here, but I don't know that I agree with the name of this one. The file name should probably include the word form.

<!-- QUESTION: render partial to DRY code?? -->
<h3>Driver Trips</h3>
<table>
<thead>

Choose a reason for hiding this comment

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

<!-- ANSWER: yes, I love that idea! -->

@@ -0,0 +1,44 @@
<table>
<thead>
<tr>

Choose a reason for hiding this comment

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

It doesn't look like this partial is being used anywhere.

# NOTE: added nested routes for passengers+trips
resources :passengers do
resources :trips, include: [:index, :show, :new, :delete]
end

Choose a reason for hiding this comment

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

You shouldn't need to nest the :delete route, since :delete already has the trip ID, which means you can figure out the passenger ID.

Choose a reason for hiding this comment

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

Also, you include :new here but it's not used in your application, and you exclude :create but do use it. I'll be honest, I'm not quite sure how the link to request a trip from the passenger show page works.

def availability
@driver = Driver.find_by(id: params[:driver_id])
is_available = @driver.available

Choose a reason for hiding this comment

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

You have a route and controller action to set the availability, but as far as I can tell it is not used in your application. Nowhere is there a link to the availability_path.

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