-
Notifications
You must be signed in to change notification settings - Fork 26
Jazz/Shelan RideShareRails #12
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
base: master
Are you sure you want to change the base?
Conversation
Rideshare RailsWhat We're Looking For
|
| class Trip < ApplicationRecord | ||
| belongs_to :passenger | ||
| belongs_to :driver | ||
|
|
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.
No validations on rating or cost?
| total = 0 | ||
| trips.each do |trip| | ||
|
|
||
| total += (trip.cost - 1.65) |
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.
indentation!
| total += (trip.cost - 1.65) | ||
| end | ||
| total_revenue = (total * 0.80) | ||
| total_revenue *= 0.01 |
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.
total revenue becomes 1% of the total revenue?
|
|
||
| def average_rating | ||
| total = 0 | ||
| self.trips.each do |trip| |
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.
This method is counting incomplete trips in the sum. You need to have some way to filter out incomplete trips.
| enum status: %i[inactive active] | ||
|
|
||
| validates :name, presence: true | ||
| validates :vin, presence: 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.
You should also validate the length.
| has_many :passengers, through: :trips | ||
| has_many :trips, dependent: :nullify | ||
|
|
||
| enum status: %i[inactive active] |
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.
👍
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