-
Notifications
You must be signed in to change notification settings - Fork 28
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 & Fire - Emily & Aimee #18
base: master
Are you sure you want to change the base?
Conversation
…saving correctly.
…saving correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! You missed a few functional things that were mostly attention to detail.
Make sure to check the feedback.md
in the future to avoid missing those little things.
Overall though your code was clean and clear and read quite nicely!
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 the test for "trips#update" failed. |
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 | You linked to the trips instead of listing them. |
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 | Rating is mandatory. |
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 | |
Yellow (Approaches Standards) | 5+ in Code Review && 4+ in Functional Requirements, or the instructor judges that this project needs special attention | ✔️ |
Red (Not at Standard) | 0-4 in Code Review or 0-3 in Functional Reqs, or assignment is breaking/doesn’t run with less than 5 minutes of debugging, 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 | ✅ |
Elegant/Clever | ✅ |
Descriptive/Readable | ✅ |
Concise | ✅ |
Logical/Organized | ✅ |
class Homepage < ApplicationRecord | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Homepage didn't need a model.
['⭐️', 1], | ||
['⭐⭐', 2], | ||
['⭐⭐⭐', 3], | ||
['⭐⭐⭐⭐', 4], | ||
['⭐⭐⭐⭐⭐', 5], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐!
get '/trips', to: 'trips#index', as: 'trips' | ||
get '/trips/new', to: 'trips#new', as: 'new_trip' | ||
post '/trips', to: 'trips#create' | ||
|
||
get '/trips/:id', to: 'trips#show', as: 'trip' | ||
get '/trips/:id/edit', to: 'trips#edit', as: 'edit_trip' | ||
patch '/trips/:id', to: 'trips#update' | ||
delete '/trips/:id', to: 'trips#destroy' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could have also been resources
:
get '/trips', to: 'trips#index', as: 'trips' | |
get '/trips/new', to: 'trips#new', as: 'new_trip' | |
post '/trips', to: 'trips#create' | |
get '/trips/:id', to: 'trips#show', as: 'trip' | |
get '/trips/:id/edit', to: 'trips#edit', as: 'edit_trip' | |
patch '/trips/:id', to: 'trips#update' | |
delete '/trips/:id', to: 'trips#destroy' | |
resources :trips |
class CreateHomepages < ActiveRecord::Migration[6.0] | ||
def change | ||
create_table :homepages do |t| | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't actually add any columns to this table. In the future you should avoid making tables like this.
@driver = Driver.new(driver_params) | ||
# default: a new driver is available | ||
@driver[:available] = true | ||
result = @driver.save |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should try to be more specific with variable names than result
.
I would probably just put the @driver.save
inline but if you want to store it in a variable I would name it something like save_result
.
validates :vin, length: { is: 17, message: "can't be blank"}, presence: true | ||
|
||
def gross_earnings | ||
gross_total = trips.sum(&:cost) / 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, the fancy &:
notation! 😃
@@ -1,175 +1,259 @@ | |||
require "test_helper" | |||
|
|||
describe DriversController do | |||
# Note: If any of these tests have names that conflict with either the requirements or your team's decisions, feel empowered to change the test names. For example, if a given test name says "responds with 404" but your team's decision is to respond with redirect, please change the test name. | |||
before(:all) do | |||
@test_driver = Driver.create(name:"C14", vin: "12345678901234567", available: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend using create!
here because it will make it obvious if your before
fails to create any data:
@test_driver = Driver.create(name:"C14", vin: "12345678901234567", available: true) | |
@test_driver = Driver.create!(name:"C14", vin: "12345678901234567", available: true) |
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