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

Cassy and Sabine - DrivesMe #6

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

Conversation

cassyarchibald
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.


My Teammate was out most of the week so this will be answered by a single teammate - Cassy *************************************

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 I setup a model for drivers/passengers/trips as each entity required business logic. There are also controllers for all entities as each one had several routes/views.
Describe the role of model validations in your application Model validations help prevent the user from entering invalid data/lets them know what they did wrong. In this case, the user can't enter a driver without a name/vin, a passenger without a name/phone number.
How did your team break up the work to be done? The first day we did a diagram of what our program might look like. I agreed to research further on potential setups for our program/my partner volunteered to be in charge of our trello board. Unfortunately this did not happen due to my partner being unable to attend class.
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 getting the controllers/routes functioning and the models created before focusing on complex logic/views/styling. We set deadlines in Trello for the more important features.
What was one thing that your team collectively gained more clarity on after completing this assignment? I feel more comfortable with migrations and that I have a better grasp on what the M/V/C roles are.
What is your Trello board URL? https://trello.com/b/ikvv9cxl/cassy-sabine-rideshare-rails
What is the Heroku URL of your deployed application? https://cassys-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? N/A - Partner was not in class.

cassyarchibald and others added 30 commits October 1, 2018 21:15
This reverts commit 9ff8755.
@CheezItMan
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 Due to Sabine's absence, mostly just Cassie's commits, but good commit messages and a good number of commits.
Answered comprehension questions Check
Uses named routes (like _path) Check, but there are small issues. For one, you didn't really use nested routes. You had a route to the new path for a form to create a trip with a passenger id set, but didn't use that route instead you went to /trips/new. You should have sent the user to the passenger_trips_path which would have been /passengers/:id/trips/new and then you could pre-set the passenger.
RESTful routes utilized Yes, with some issues, see my inline notes.
Project Requirements
Table relationships Check
Validation rules for Models Yes, with some errors, see my inline notes.
Business logic is in the models Check
Database is seeded from the CSV files Check
Trello board is created and utilized in project management Check
Heroku instance is online Check
The app is styled to create an attractive user interface
Overall Understandably a couple of things are missing, you don't have a way to automatically set the driver for a trip and instead the person has to fill in a form. Also if a trip doesn't have a rating it crashes on the driver's path, and if the cost of the trip is nil it crashes on the passenger's show path. You also have some other issues, but given that Cassie had to work solo most of the week, nicely done.

<td><%="#{@trip.date}" %></td>
<td><%="#{@trip.rating}" %></td>
<td><%="$#{@trip.convert_money(@trip.cost)}" %></td>
<td><%=link_to "#{@trip.driver_id}", driver_path(@trip.driver_id) %></td>

Choose a reason for hiding this comment

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

I'd recommend showing the passenger and driver's names instead of ids.

Copy link
Author

Choose a reason for hiding this comment

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

Hi Chris, could you or Devin go over how to do this with me? I tried to set @driver and @Passenger in the trip show method so I could use it in this view as @driver.name/@passenger.name but was not successful.

end

def update
passenger = Passenger.find_by(id: params[:id].to_i)

Choose a reason for hiding this comment

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

This isn't showing the user validation errors or asking them to fix the form. That's because you don't have an if statement checking to see if the update method returned true.

<% else %>
<h1><%[email protected] %></h1>
<button>
<%= link_to "Add A Trip", new_trip_path %>

Choose a reason for hiding this comment

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

You should make this route be for the passenger_trip_path so the passenger can be pre-set.


def amount_earned
sum = 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.

You need to consider when the trip's cost might be nil (incomplete trips).

Copy link
Author

Choose a reason for hiding this comment

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

Could this be an if statement like this?
def amount_earned sum = 0 self.trips.each do |trip| # converting cents to dollars if trip.cost.nil? raise ArgumentError, "Please enter trip cost" end
Or would I do a method to only show the amount earned if the trip.cost is not nil?

Choose a reason for hiding this comment

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

@cassyarchibald You could do something like this.

self.trips.select {|trip| trip.cost != nil }.each do |trip|


def total_charged
charged = 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.

Consider incomplete trips. In that case the trip.cost would be nil.

Rails.application.routes.draw do
root "trips#index"

resources :trips, :drivers, :passengers

Choose a reason for hiding this comment

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

Do you need a route for get '/trips'? What about /trips/new? Will you ever bring up a trip form without a passenger?


# Nested routes for drivers and passengers to have access to associated trips
resources :drivers do
resources :trips, only: [:index, :new]

Choose a reason for hiding this comment

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

Do you ever show a trips index page in the context of a driver or passenger? Do you ever create a new trip in the context of a driver? Driver's don't normally initiate the rideshare process.

Copy link
Author

Choose a reason for hiding this comment

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

Hmm I think i'm still a bit confused on nested routes. Would it have made more sense for these to be in reverse order where the nested routes are :drivers and :passengers, only [:index, :new]/trips being the outer resources? Would that mean that creating a new driver/passenger would be in the context of a trip/trips are initiating the rideshare process rather than vice versa?

Choose a reason for hiding this comment

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

@cassyarchibald
I don't think you ever need a :new action for trips, as you don't really need a form for it. I'm not sure you even need an index page for trips, as we mostly just show trips in the driver and passenger show pages.

end
return charged
end

Choose a reason for hiding this comment

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

It's good that you have some business logic here. You should also include a method to generate a trip for the current passenger assigning a driver.

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