Skip to content

Feedback PR only#25

Open
case-eee wants to merge 177 commits into
case-eee:masterfrom
jdconrad89:master
Open

Feedback PR only#25
case-eee wants to merge 177 commits into
case-eee:masterfrom
jdconrad89:master

Conversation

@case-eee

Copy link
Copy Markdown
Owner

do not merge

ski-climb and others added 29 commits December 7, 2016 18:38

@case-eee case-eee left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@ski-climb @lucyconklin @jdconrad89 @akintner great job on this 🎉 let me know if you have questions on any of my comments/suggestions!

also - great work on committing often 👍


class BikeShareApp < Sinatra::Base
set :method_override, true
include WillPaginate::Sinatra::Helpers

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

👍

end

get '/stations/' do
@stations = Station.paginate(:page => params[:page], :per_page => 30)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

👍

post '/stations' do
city = City.find_or_create_by(name: params[:city])
station = Station.create(params[:station])
station.city_id = city.id

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

rather than setting the city_id manually, we could do something like this to leverage the full power of ActiveRecord:

city = City.find_or_create_by(name: params[:city])
city.stations.create(params[:station])

then, we don't need the save 👍

end

get '/cities/new' do
erb :"cities/new"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

love that your nesting your view templates within folders 👍

Comment thread app/models/condition.rb
validates :precipitation_inches, presence: true
validates :measurement_date, presence: true

def present_date

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

👍

Comment thread app/models/trip.rb
"Subscribers = #{hash[subscriber_id]}"
end

def self.user_percentage

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

this method's doing a lot of stuff - can we break it down?

name: subscription_name
)

zipcode = Zipcode.find_or_create_by(

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

👍 find_or_create_by

<li>November: <%= @trips.rides_per_month(11) %></li>
<li>December: <%= @trips.rides_per_month(12) %></li>
</ul>
<p><%= @trips.rides_per_year(2016) %><br?></p>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

this snippet here is a great candidate for a partial - since the html here and code is pretty similar (except for the year). we can re-use this piece of html by putting it in a partial 👍 if you want to dive into that further and have questions, let me know!

Comment thread app/views/trips/index.erb
<td><%= trip.id %></td>
<td><%= trip.duration_in_seconds%></td>
<td><%= trip.start_date%></td>
<td><%= @stations.find_by(id: trip.start_station_id).name%></td>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

this is an example of querying your database in your views since you're calling find_by - how can we remove this logic and keep our views simply displaying data that the controller fetches for us?

describe "When a user wants to delete the weather conditions for a day" do

context "they can delete from the show" do
let(:today) { Date.today }

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

love that you're using let 👍

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.

4 participants