Skip to content

Conversation

@sjlee3157
Copy link

@sjlee3157 sjlee3157 commented Oct 5, 2018

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 A driver has many trips, a passenger has many trips, and each trip has one and only one driver and passenger. We set it up this way to be able to view and access data between models.
Describe the role of model validations in your application To prevent incomplete or inaccurate data types from being saved into the database by the user.
How did your team break up the work to be done? We set up the project foundations together, which allowed us to think and talk about what pieces of the app were similar enough to be done by one person (e.g. driver/passenger view pages). For the work we did independently, we decided what parts of the app were independent enough that our work wouldn't conflict. For example, typically only one person was styling CSS at a time.
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 project requirements before any styling. Once the minimum required back-end code was written, we also prioritized any CSS styling that was high-impact or high-satisfaction so that our site would look good and be fun to work on.
What was one thing that your team collectively gained more clarity on after completing this assignment? We gained a better understanding on routes along with how to use models and access those models from other controllers. We also felt like we were able to plan this project better and manage our time with the different parts (back-end, front-end).
What is your Trello board URL? https://trello.com/b/lX9w1iZz/sammi-jo-danielle
What is the Heroku URL of your deployed application? https://take-a-little-trip.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? Sammi-Jo: I appreciate how Danielle kept me from getting sidetracked in Rails by suggesting a simple solution that we've seen before from ada books.
Danielle Metzner: I really appreciated Sammi-Jo's input and feedback when we were trying to find bugs in our code, she was really amazing at finding simple things I missed. She was also super good about creating visibility with Trello about what we were working on :) .

sjlee3157 and others added 30 commits October 1, 2018 15:56
@CheezItMan
Copy link

Rideshare Rails

What We're Looking For

Feature Feedback
Baseline
Appropriate git usage with no extraneous files checked in and both partners contributing Good number of commits and good commit messages, both partners contributed.
Answered comprehension questions Check, I'm glad you seemed to work well together
Uses named routes (like _path) Check
RESTful routes utilized Check with
Project Requirements
Table relationships Check
Validation rules for Models Check
Business logic is in the models Check, lots of good methods in the models.
Database is seeded from the CSV files Check
Trello board is created and utilized in project management Check
Heroku instance is online Check
The app is styled to create an attractive user interface Nice styling, good front-end validations
Overall Good work, you hit the learning goals and did a nice job on validations. You also validated things on the browser side with HTML validations as well as the model. Nice!

<button><%= link_to "Delete", driver_path(@driver.id), method: :delete, data: {confirm: 'Are you sure you want to delete this driver?'} %></button>


<%= render partial: "layouts/personaltrips",

Choose a reason for hiding this comment

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

Good idea to use a partial in the show view!

<div id="form-div">


<%= form_with model: model, url: url, method: method, class:"form" , id:"form1" do |f| %>

Choose a reason for hiding this comment

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

I think with the state of the model you don't need to specify the url field.

resources :trips, except: [:create, :new]
resources :drivers
resources :passengers, except: [:show] do
resources :trips, only: [:index, :show, :create]

Choose a reason for hiding this comment

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

Do you need the index and show actions here?

You are using the trips index page to show the details on the passenger, rather than details on the passenger. It works, but kinda odd.

@@ -0,0 +1,26 @@
<div id="form-main">

Choose a reason for hiding this comment

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

Do you need to have a separate screen to edit a trip? Could you instead rate the trip on the passenger's show page?

@@ -0,0 +1,50 @@
class Driver < ApplicationRecord
has_many :trips, dependent: :nullify

Choose a reason for hiding this comment

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

Interesting way to handle the deletion of Drivers. This will work, but leave trips without a driver.

<% cost_placeholder = @trip.formatted_cost %>
<% value_placeholder = @trip.formatted_cost %>
<% end %>
<%= f.text_field :cost, value: cost_value, placeholder: cost_placeholder, pattern: '\d{1,3}.\d{2}', required: true, class: "feedback-input", id: "cost_image" %>

Choose a reason for hiding this comment

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

It's good that you're using front-end validations, but you still need model validations!


def total_earnings
#The driver gets 80% of the trip cost after a fee of $1.65 is subtracted
total_cost = self.trips.reduce(0) { |sum, trip|

Choose a reason for hiding this comment

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

Good use of reduce!

As a style comment, instead of using { } for multiline blocks use do ... end instead.

end
end

def assign_random_cost

Choose a reason for hiding this comment

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

This should probably be a self method or actually change the cost field of the Trip.


def status
if self.trips.any? { |trip| trip.cost == nil || trip.rating == nil }
return :in_progress

Choose a reason for hiding this comment

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

Semantically this would probably be better to return :on_trip

belongs_to :passenger
validates :date, presence: true
validates :rating, presence: {message: "can't be blank. Trip won't end until you select a rating." }, unless: :passenger_is_requesting_trip
validates :cost, presence: {message: "can't be blank."}, unless: :passenger_is_requesting_trip

Choose a reason for hiding this comment

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

Neat validations, and custom messages.

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