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

Katrina && Melissa - Edges - Ride Share #17

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

Conversation

kaganon
Copy link

@kaganon kaganon commented Oct 5, 2018

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 set up our relationships with a driver 'has-many' trips, a passenger 'has-many' rides, and a trip has-one passenger, and a trip has one driver.
Describe the role of model validations in your application The specific model validations we used included a check to verify if the data submission in the forms were not empty and was unique. We also did a 'validation' to check if the user truly wants to delete a driver, passenger, or trip before deleting the object.
How did your team break up the work to be done? We mostly worked together in pairs throughout the week, but assigned passengers to one person and drivers to another. Towards the end we split up and worked independently on some (limited) html/css styling.
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 set aside styling and worked on the requirements of the project. If we had more time, we would definitely spend more time on styling the pages.
What was one thing that your team collectively gained more clarity on after completing this assignment? RAILSS!! Making sure that routes are nested and the HTTP verbs match the routes. Towards the end of the project, we were more comfortable handling errors through debugging with rails console, and the rails error page (like the stack trace, etc).
What is your Trello board URL? https://trello.com/b/BY040dxB/katrina-melissa
What is the Heroku URL of your deployed application? http://ryde-baby-ryde.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 both liked direct and fast feedback from each other, and that worked worked well for the project!

@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 redundancy - see inline
Project Requirements
Table relationships yes
Validation rules for Models yes
Business logic is in the models mostly - see inline
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 relations, and most of your business logic is in the model - it's clear to me that the learning goals for this week were met. As with any project of this size I've left a number of nitpicks, and it would be good to review view partials, but in general I am happy with what I see here. Keep up the hard work!

<!-- Trip details for passenger -->
<% elsif @trips.first.passenger == @user %>
<strong><%= link_to "Request Ride", passenger_trips_path(@user.id), method: :post %></strong>
<strong><%= link_to "Edit This Passenger", edit_passenger_path(@user.id) %></strong>

Choose a reason for hiding this comment

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

Because these buttons are inside of this conditional, if a user does not have any rides, they cannot request a ride!

<!-- Trip details for driver -->
<% elsif @trips.first.driver == @user %>
<p><%= link_to "Edit This Driver", edit_driver_path(@user.id) %></p>
<p><%= link_to "Delete This Driver", driver_path(@user.id), method: :delete,

Choose a reason for hiding this comment

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

The fact that this page contains such a big if statement implies to me that it ought to be two different pages.


sum = driver_trips.sum { |t| t.rating }.to_f

return sum / driver_trips.length

Choose a reason for hiding this comment

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

This will cause problems if the driver has no trips (trying to divide by zero)

if driver.destroy
redirect_to drivers_path
else
render :show

Choose a reason for hiding this comment

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

I don't believe that driver.destroy can fail. If it did, this error handling code wouldn't work anyway - you don't have a show page for drivers.

def create
@passenger = Passenger.find_by(id: params[:passenger_id])
@driver = Driver.find_by(status: true)
@trip = @passenger.trips.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. A class method on Trip would probably work nicely, something like Trip.request_for(passenger_id).

Also, this action doesn't render a view, so you shouldn't need to use instance variables.


@trip.save

redirect_to passenger_trips_path

Choose a reason for hiding this comment

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

What if saving the trip fails?

def rating(trip)
if trip.rating.present?
trip.rating
else

Choose a reason for hiding this comment

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

Great use of a view helper here!


<%= form_for @passenger do |f| %>
<%= f.label :name %>
<%= f.text_field :name %>

Choose a reason for hiding this comment

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

You have the same form for both edit and new. Could you DRY this up with a view partial?

resources :trips, only: [:index, :assign_rating]
end

resources :drivers, except: [:show]

Choose a reason for hiding this comment

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

You don't need to include resources :drivers twice. The resources method can take both a block and an except keyword argument.


root 'homepages#index'

resources :homepages, only: [:index]

Choose a reason for hiding this comment

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

Given how your site is designed, I might not even include the route for /homepages, and use the root route everywhere.

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