Skip to content

Feedback PR only#27

Open
case-eee wants to merge 202 commits into
case-eee:masterfrom
Sh1pley:master
Open

Feedback PR only#27
case-eee wants to merge 202 commits into
case-eee:masterfrom
Sh1pley:master

Conversation

@case-eee

Copy link
Copy Markdown
Owner

do not merge

wlffann and others added 30 commits December 3, 2016 13:06
Merge CRUD_stations_laszlo branch into CRUD_stations branch
Jesse Shipley and others added 29 commits December 7, 2016 15:06
Local merge of iteration6-laszlo with latest version of iteration6
Iteration6 shipley ok to be merged into `iteration6`
Local merge with master update with images and iteration6-laszlo branch.
Iteration6 merge into master for new baseline
Local merge to ensure using new baseline.
Laszlo error handling refactor into MASTER
Laszlo error handling refactor into Master

@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.

@wlffann @Laszlo-JFLMTCO @Sh1pley @MarisaMBurton good work on this project. i left ya some comments - let me know if you have questions on any of my comments or anything else 🎉

also - i LOVE all the commits. woooo 👍

keep up the hard work!

require 'will_paginate/active_record'

class BikeShareApp < Sinatra::Base
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.

👍


get '/stations/:id' do
@station = Station.find(params[:id])
erb :"stations/show"

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.

good work nesting your files with your views


put '/stations/:id' do
station = Station.find(params[:id])
station.write_update(station, params[:stations])

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.

since write_update is an instance method, do we need to pass in the specific station since we already have access to it? you can access all the attributes within a specific instance of Station within an instance method 👍


get '/trips/:id/edit' do
@trip = Trip.find(params[:id])
@subscription_type = Subscription.find(@trip.subscription_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.

if trip has an association with subscription, we should be able to just call @trip.subscription rather than calling find

Comment thread app/models/condition.rb

class Condition < ActiveRecord::Base
include DateFormat
has_many :trips, class_name: "Trip", primary_key: "date", foreign_key: "start_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
@@ -0,0 +1,167 @@
require_relative '../models/subscription'
require_relative '../models/date_format'

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.

you shouldn't have to manually require these models. they should all be required for you in config/environment.rb

</tr>
<tr>
<td>41-50</td>
<td><%= Condition.average_number_of_rides_in_range_max_temp(41..50) %></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.

we talked about this in your eval, but i'll reiterate it here. currently, we're overstepping the controller's responsibilities. the controller should grab this data from your models and the view should simply display the data. as this view template stands, there's too much logic here because it's actually querying your database by accessing a model directly.


<tr>
<td><h3> Total Station Count</td></h3>
<td><h3> <%= Station.count %> </td></h3>

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.

same here - we want our controller to get the data and our view to simply display it 👍

<div class="thumbnail">
<div class="caption">
<h3>Single Date with Most Trips</h3>
<p>Date: <%= Trip.date_with_highest_number_of_trips_with_count_of_those_trips[:date_with_most_trips] %></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.

same here!

end

it "they press the delete button from the show file" do
Station.write(name: "TestStation1",

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.

you can DRY this up a bit by using a before filter or let blocks in RSPEC 👍

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