Skip to content

Earth - Beauttie & Water - Mackenzie#20

Open
beauttie wants to merge 42 commits intoAda-C14:masterfrom
beauttie:master
Open

Earth - Beauttie & Water - Mackenzie#20
beauttie wants to merge 42 commits intoAda-C14:masterfrom
beauttie:master

Conversation

@beauttie
Copy link

@beauttie beauttie commented Nov 7, 2020

Assignment Submission: Rideshare Rails

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions. These questions should be answered by all team members together, not by a single teammate.

Reflection

Prompt Response
Describe the types of entity relationships you set up in your project and why you set up the relationships that way Passenger and Driver can have zero or many Trips, and a Trip belongs to a Driver and Passenger (to create these entity relationships when seeding the data and connect the trips to a driver and passenger).
Describe the role of model validations in your application To ensure appropriate information is entered for each attribute so that our model methods can run with no errors and to notify the user why the input is invalid
How did your team break up the work to be done? We mostly did the work together and switched between the roles of driver and navigator. We also did some research beforehand independently.
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? Functionality was prioritized; look and feel was set aside.
What was one thing that your team collectively gained more clarity on after completing this assignment? Active Record relationships and database migrations
What are two discussion points that you and your team discussed when giving/receiving feedback from each other that you would be willing to share? We established that we both wanted straightforward feedback and a routine for collaboration via Slack.
Optional: What is the URL of your deployed Heroku app? NA

beauttie and others added 30 commits November 2, 2020 14:35
Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Rideshare Rails

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Practices collaborating with git, and all team members contribute git commits and best git practices ✔️
Demonstrates understanding of relationships by giving accurate answers to the reflection questions and appropriate code in the models ✔️
Logic to calculate a driver's average rating and total earnings is located in the model, and it has unit tests ✔️
There are reasonable tests to test the validation requirements for all models ✔️
There are reasonable tests to test the relationship requirements for all models ✔️
There are reasonable tests to test the controller actions for all controllers ✔️
The app has an attractive and usable user interface ✔️
The app uses/is compatible with database seeds ✔️
Router code is clean: uses resources and RESTful routes ✔️

Functional Requirements

Functional Requirement yes/no
On the passenger's details page, I want to be able to see total charged, list of trips, a link to edit, and delete ✔️
When adding a new passenger, I want to see errors and validations that show that a passenger must be provided a name and a phone number, so that I cannot make a passenger without name or phone number ✔️
On the passenger's details page, I can create a new trip for this passenger, with an assigned driver and no rating ✔️
On the driver's details page, I want to be able to see total earnings, average rating, list of trips, a link to edit, and delete ✔️
When adding a new driver, I want to see errors and validations that show that a driver must be provided a name and VIN, so that I cannot make a driver without name or VIN ✔️
On the trip's detail page, I want to be able to view details, assign a rating, navigate to the trip's passenger, driver, a link to edit, and delete ✔️

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 8+ in Code Review && 5+ in Functional Requirements

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Elegant/Clever
Descriptive/Readable
Concise
Logical/Organized

Summary

Nice work, y'all hit the learning goals. Well done. I left comments on several minor issues throughout the app. Please look at them and let me know what questions you have.


/public/assets
.byebug_history

Choose a reason for hiding this comment

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

I suggest you add .idea to the .gitignore file.

Suggested change
.idea

redirect_to drivers_path
return
else
redirect_to driver_path(@driver.id)

Choose a reason for hiding this comment

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

So if the driver has trips you can't delete them?

Comment on lines +61 to +68
elsif @passenger.trips.empty?
@passenger.destroy
redirect_to passengers_path
return
else
redirect_to passenger_path(@passenger.id)
return
end

Choose a reason for hiding this comment

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

So if the passenger has trips, they can't be destroyed.

@@ -0,0 +1,19 @@
class Driver < ApplicationRecord

Choose a reason for hiding this comment

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

Good validations and methods

Comment on lines +3 to +9
<% if @driver.errors.any? %>
<ul class="errors">
<% @driver.errors.each do |column, message| %>
<li><strong><%= column %></strong> <%= message %></li>
<% end %>
</ul>
<% end %>

Choose a reason for hiding this comment

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

Why not put this into the partial?

Comment on lines +19 to +28
<ol>
<% @driver.trips.each do |trip| %>
<li> ID: <%= link_to trip.id, trip_path(trip) %> --
Driver: <%= trip.driver.name %> --
Passenger: <%= trip.passenger.name %> --
Cost: <%= number_to_currency(trip.cost/100) %> --
Rating: <%= trip.rating %>
</li>
<% end %>
</ol>

Choose a reason for hiding this comment

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

Just noting this is a great candidate for a partial, anytime you need a list of trips, you can just call the partial.

@@ -0,0 +1,13 @@
<h2>New Passenger</h2>

Choose a reason for hiding this comment

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

You don't need this file!

root to: 'homepages#index'

resources :passengers do
resources :trips, only: [:index, :create]

Choose a reason for hiding this comment

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

You're not really using index as a nested route.

belongs_to :passenger
belongs_to :driver

validates :rating, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 1, less_than_or_equal_to: 5 }

Choose a reason for hiding this comment

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

No validation for cost?


validates :name, presence: true
validates :phone_num, presence: true, uniqueness: true

Choose a reason for hiding this comment

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

I would also add a method to request_trip

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