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

Ports - Margaret & Steph #1

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

Conversation

smarchante1
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 Our entities are: driver, trip and passenger. Drivers and Passengers both have trips. And a trip has a driver and a passenger.
Describe the role of model validations in your application They validate certain form fields that are required and prevent the creation of a new trip or passenger etc, without required fields.
How did your team break up the work to be done? We worked in tandem for the three main MVC's. Then we split tasks with Margaret working on tests for driver and passenger while Steph worked on HTML and CSS. Then we swapped places. Finally, we deployed together.
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 showing and creating data (i.e. new trip, edit). Some features such as toggling for driver availability are still on our low priority Trello board.
What was one thing that your team collectively gained more clarity on after completing this assignment? Nested routes.
What is your Trello board URL? https://trello.com/b/nWxpMPfM/ride-share-rails
What is the Heroku URL of your deployed application? https://marganie-ride-share.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 made decisions together and talked about any changes we wanted to make as the project went along. Any time we worked individually we made a plan of who would do what first and we made use of our Trello board to organize tasks.

smarchante1 and others added 30 commits April 15, 2019 15:16
…w and index for driver, created show and index html.erb
msfinnan and others added 28 commits April 18, 2019 13:21
@CheezItMan
Copy link

CheezItMan commented Apr 26, 2019

Rideshare Rails

What We're Looking For

Feature Feedback
Baseline
Appropriate git usage with no extraneous files checked in and all team members contributing I do notice that you have a .DS_Store file checked into git. Good number of commits and good commit messages
Answered comprehension questions Check
Uses named routes (like _path) Check
RESTful routes utilized You have a lot of unused routes defined in your routes.rb file.
Project Requirements
Table relationships Check
Business logic is in the models Check, see one method that I suggested.
Controller tests See my inline comments, you have a number of issues in the tests
Database is seeded from the CSV files Check
Trello board is created and utilized in project management Check
Heroku instance is online Check, I noticed I get an error when I try to request a trip.
The app is styled to create an attractive user interface Well done
Overall You hit most of the major learning goals, see my inline comments, there are quite a few. As you noted you can't have a passenger request a trip or a driver go offline or online. I would also suggest making the business logic of having a passenger request a ride part of the Passenger model. Let me know if you have questions. Also look at your routes.rb file. You have a lot of unused routes listed.

trip: {
date: "April 19, 2019",
cost: 1445,
passenger_id: Passenger.last.id,

Choose a reason for hiding this comment

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

A couple of things:

  1. This isn't in an it block so you don't have a Passenger or Driver at this stage.
  2. Unless you have a fixture or a before block that creates a passenger this test will have an error! :(

@@ -0,0 +1,15 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

Choose a reason for hiding this comment

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

Nice try at fixtures, as you learned this week you can't set the foreign key fields like driver_id in this way. Instead do something like:

driver: one
passenger: two

end

describe "create" do
it "should create a new trip" do

Choose a reason for hiding this comment

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

There really isn't a form being submitted for the trips controller, Instead the trip data is being set automatically

must_respond_with :redirect
end

it "returns an error for and invalid trip" do

Choose a reason for hiding this comment

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

Again, you don't have a form submitting to the create action, instead a link is used. The only thing you need to test is when the create action is given an invalid passenger id.

trip: {
date: date,
cost: cost,
passenger_id: 0,

Choose a reason for hiding this comment

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

At least you are checking with an invalid passenger id.

@@ -0,0 +1 @@
<%= link_to "All Drivers", drivers_path %>

Choose a reason for hiding this comment

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

Is this page really used? Should it be?

Also you have a trips/new.html.erb view, do you need one?

@@ -0,0 +1,4 @@
class Trip < ApplicationRecord
belongs_to :driver

Choose a reason for hiding this comment

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

You could also add validations to prevent a trip with an invalid cost or rating.

validates :phone_number, presence: true

def total_charges
return (self.trips.sum { |trip| trip.cost }) / 100

Choose a reason for hiding this comment

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

If you want to show this with decimal numbers you should divide by 100.0 or convert it to a float before the division.


validates :name, presence: true
validates :phone_number, presence: true

Choose a reason for hiding this comment

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

Another nice business logic method would be to make a request_trip method which would generate a trip for a specific instance of passenger. That would help you DRY up your controller.

end

def create
passenger = Passenger.find_by(id: params[:trip][:passenger_id])

Choose a reason for hiding this comment

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

passenger_id is a route parameter, not a field submitted by a form. Instead this should be:

passenger = Passenger.find_by(id: params[:passenger_id])

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