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

Earth & Water - Denise & Kayla - RideShare Rails #13

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

Conversation

Kaylaj89
Copy link

@Kaylaj89 Kaylaj89 commented Nov 6, 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 We set it up so that drivers have many trips, passengers have many trips, and trips belong to a driver and a passenger. The user stories as well as Ada project prompts steered us in this direction.
Describe the role of model validations in your application Model validations ensure the params criteria are respected and followed throughout the entire project.
How did your team break up the work to be done? We established a trello board and met daily to discuss which items we should do on our own versus 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 the baseline requirements and functionalities. At this point, we do not have a plan in place for if a driver or passenger are deleted from a trip--or if a driver or passenger is deleted from the database when they are connected to a trip.
What was one thing that your team collectively gained more clarity on after completing this assignment? Denise: Gained clarity on validations and nested routes. Kayla: Rails is powerful and there is a lot more to explore.
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? To start, Denise and I discussed questions on a shared word document about preferred communication style and schedule for the week. We also worked off of a trello board: https://trello.com/b/8iPfu56U/rails-rideshare-project.
Optional: What is the URL of your deployed Heroku app? https://infinite-cove-23283.herokuapp.com/

Kaylaj89 and others added 30 commits November 2, 2020 16:03
…ds for Drivers class // Implemented prived method for driver strong params
…ml pages (index, new, and edit) to driver view
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 ⚠️ No tests for trip validations, and missing tests for regex in other models
There are reasonable tests to test the relationship requirements for all models ⚠️, no tests for relationships in Trips
There are reasonable tests to test the controller actions for all controllers ⚠️, Missing a lot of tests
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 ⚠️, See my notes inline on your routes.rb

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 ✔️, see one bug with validations in your controller
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
Yellow (Approaches Standards) 5+ in Code Review && 4+ in Functional Requirements, or the instructor judges that this project needs special attention 💛

Code Style Bonus Awards

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

Quality Yes?
Perfect Indentation
Descriptive/Readable
Logical/Organized

Summary

It's clear you had trouble getting the tests in. That was your biggest problem in this project. Otherwise the site mostly works. Take a look at my comments and let me know what questions you have. In bEtsy, I'd like you to focus on writing model & controller tests, so you get the practice down. It's something to work on. Otherwise the site looks good and functions pretty well overall.

class Passenger < ApplicationRecord
has_many :trips
validates :name, presence: true
validates :phone_num, presence: true, format: { with: /\d{3}.*\d{3}.?\d{4}/ }

Choose a reason for hiding this comment

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

nice I like the regex

Comment on lines +6 to +8
def total_spent
return self.trips.map {|trip| trip.cost/100.0}.sum
end

Choose a reason for hiding this comment

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

Nice enumerable!

trips_for_driver = self.trips
ratings = 0
count = 0
trips_for_driver.each do |trip|

Choose a reason for hiding this comment

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

Just a note that you could use an Enumerable method like .sum

Comment on lines +2 to +8
<div class="errors">
<% @driver.errors.each do |column, message| %>
<p>
Oops! Your data doesn't look quite right: <strong><%= column.capitalize %></strong> <%= message %>.
</p>
<% end %>
</div>

Choose a reason for hiding this comment

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

👍

Comment on lines +50 to +55
elsif @passenger.update(passenger_params)
redirect_to passenger_path
return
render :edit, status: :bad_request
return
end

Choose a reason for hiding this comment

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

Missing an else case here. This is causing the validation messages not to show.

Suggested change
elsif @passenger.update(passenger_params)
redirect_to passenger_path
return
render :edit, status: :bad_request
return
end
elsif @passenger.update(passenger_params)
redirect_to passenger_path
return
else
render :edit, status: :bad_request
return
end

end

describe "update" do
# Your tests go here
it " ill name it later" do

Choose a reason for hiding this comment

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

Really, you will?

get edit_trip_path(old_trip)

must_respond_with :success
end
end

describe "update" do

Choose a reason for hiding this comment

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

No tests for updating a nonexistant trip.

No test for updating a trip with invalid params.

end

Choose a reason for hiding this comment

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

No controller tests for add_rating


invalid_id = 'bad id'

expect {delete trip_path(invalid_id)}.wont_change "Trip.count"

Choose a reason for hiding this comment

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

No test for response code.

end

describe "destroy" do
# Your tests go here
it "Deletes an instance of trip and redirects" do

Choose a reason for hiding this comment

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

No check for response code.

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