{"action":"created","comment":{"url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/comments/25020482","id":25020482,"diff_hunk":"@@ -0,0 +1,147 @@\n+enable :sessions\n+\n+get '/' do\n+  redirect '/user' if session[:user_id]\n+    @da = Station.find(13)\n+    @du = Station.find(15)\n+    @fr = Station.find(19)\n+    @ml = Station.find(26)\n+    @pt = Station.find(31)\n+    @rd = Station.find(34)\n+  @stations = Station.all\n+  erb :index\n+end\n+\n+\n+post '/eta' do\n+  session[:station] = params[:station]\n+  session[:destination] = params[:destination]\n+  session[:eta] = []\n+  transfer = false\n+  response = Bart::Realtime.etd(session[:station]).destinations\n+  response.map do |destination|\n+    if destination.abbr == session[:destination]\n+      destination.estimates.map do |estimate|\n+        session[:eta] << {\n+          minutes: estimate.minutes,\n+          platform: estimate.platform,\n+          direction: estimate.direction,\n+          length: estimate.length,\n+          color: estimate.color,\n+        }\n+      end\n+    else\n+    end\n+  end\n+  redirect '/'\n+end\n+\n+\n+get '/login'  do\n+\tredirect '/user' if session[:user_id]\n+  erb :'/user/user_login'\n+end\n+\n+\n+post '/login' do\n+\tuser = User.find_by(username: params[:username])\n+  unless user\n+    session[:errors] = true\n+    redirect '/login'\n+  end\n+  if user.password == params[:password]\n+    session[:user_id] = user.id\n+    redirect '/user'\n+  else\n+    session[:errors] = user.errors.messages\n+    redirect '/login'\n+  end\n+end\n+\n+\n+get \"/register\" do\n+\tredirect '/user' if session[:user_id]\n+  erb :'/user/user_register'\n+end\n+\n+\n+post \"/register\" do\n+  user = User.create(params[:user])\n+  if user.errors.any?\n+    session[:errors] = user.errors.messages\n+    redirect '/register'\n+  else\n+    redirect '/login'\n+  end\n+end\n+\n+\n+get '/user' do\n+  if session[:user_id]\n+    @da = Station.find(13)\n+    @du = Station.find(15)\n+    @fr = Station.find(19)\n+    @ml = Station.find(26)\n+    @pt = Station.find(31)\n+    @rd = Station.find(34)\n+    @stations = Station.all\n+    @user = User.find(session[:user_id])\n+    erb :'/user/user_index'\n+  else\n+    redirect '/'\n+  end\n+end\n+\n+\n+post '/user/eta' do","path":"app/controllers/index.rb","position":96,"original_position":96,"commit_id":"4df4467c2f6aa0cf87a49172fdd4a2de0eb167bb","original_commit_id":"4df4467c2f6aa0cf87a49172fdd4a2de0eb167bb","user":{"login":"jareddbc","id":4805277,"avatar_url":"https://avatars.githubusercontent.com/u/4805277?v=3","gravatar_id":"","url":"https://api.github.com/users/jareddbc","html_url":"https://github.com/jareddbc","followers_url":"https://api.github.com/users/jareddbc/followers","following_url":"https://api.github.com/users/jareddbc/following{/other_user}","gists_url":"https://api.github.com/users/jareddbc/gists{/gist_id}","starred_url":"https://api.github.com/users/jareddbc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jareddbc/subscriptions","organizations_url":"https://api.github.com/users/jareddbc/orgs","repos_url":"https://api.github.com/users/jareddbc/repos","events_url":"https://api.github.com/users/jareddbc/events{/privacy}","received_events_url":"https://api.github.com/users/jareddbc/received_events","type":"User","site_admin":false},"body":"This action is way way too big. I cant understand whats going on in here. You should break it up into helpers or methods on models. Or entirely new classes / modules. Controller actions should be a few clear lines of work only.","created_at":"2015-02-19T20:08:26Z","updated_at":"2015-02-19T20:08:26Z","html_url":"https://github.com/sf-squirrels-2015/ph2-pA-week-1-passion-project/pull/18#discussion_r25020482","pull_request_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/comments/25020482"},"html":{"href":"https://github.com/sf-squirrels-2015/ph2-pA-week-1-passion-project/pull/18#discussion_r25020482"},"pull_request":{"href":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/18","id":28937392,"html_url":"https://github.com/sf-squirrels-2015/ph2-pA-week-1-passion-project/pull/18","diff_url":"https://github.com/sf-squirrels-2015/ph2-pA-week-1-passion-project/pull/18.diff","patch_url":"https://github.com/sf-squirrels-2015/ph2-pA-week-1-passion-project/pull/18.patch","issue_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/issues/18","number":18,"state":"open","locked":false,"title":"BART Station ETA - Passion Project A","user":{"login":"rgrewalucsb","id":9101492,"avatar_url":"https://avatars.githubusercontent.com/u/9101492?v=3","gravatar_id":"","url":"https://api.github.com/users/rgrewalucsb","html_url":"https://github.com/rgrewalucsb","followers_url":"https://api.github.com/users/rgrewalucsb/followers","following_url":"https://api.github.com/users/rgrewalucsb/following{/other_user}","gists_url":"https://api.github.com/users/rgrewalucsb/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrewalucsb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrewalucsb/subscriptions","organizations_url":"https://api.github.com/users/rgrewalucsb/orgs","repos_url":"https://api.github.com/users/rgrewalucsb/repos","events_url":"https://api.github.com/users/rgrewalucsb/events{/privacy}","received_events_url":"https://api.github.com/users/rgrewalucsb/received_events","type":"User","site_admin":false},"body":"BART Station ETA - Passion Project A","created_at":"2015-02-09T17:01:03Z","updated_at":"2015-02-19T20:08:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f72349d9ce2eb7e05b617d7bdda20f1397190af","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/18/commits","review_comments_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/18/comments","review_comment_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/comments/{number}","comments_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/issues/18/comments","statuses_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/statuses/4df4467c2f6aa0cf87a49172fdd4a2de0eb167bb","head":{"label":"rgrewalucsb:master","ref":"master","sha":"4df4467c2f6aa0cf87a49172fdd4a2de0eb167bb","user":{"login":"rgrewalucsb","id":9101492,"avatar_url":"https://avatars.githubusercontent.com/u/9101492?v=3","gravatar_id":"","url":"https://api.github.com/users/rgrewalucsb","html_url":"https://github.com/rgrewalucsb","followers_url":"https://api.github.com/users/rgrewalucsb/followers","following_url":"https://api.github.com/users/rgrewalucsb/following{/other_user}","gists_url":"https://api.github.com/users/rgrewalucsb/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrewalucsb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrewalucsb/subscriptions","organizations_url":"https://api.github.com/users/rgrewalucsb/orgs","repos_url":"https://api.github.com/users/rgrewalucsb/repos","events_url":"https://api.github.com/users/rgrewalucsb/events{/privacy}","received_events_url":"https://api.github.com/users/rgrewalucsb/received_events","type":"User","site_admin":false},"repo":{"id":30516028,"name":"ph2-pA-week-1-passion-project","full_name":"rgrewalucsb/ph2-pA-week-1-passion-project","owner":{"login":"rgrewalucsb","id":9101492,"avatar_url":"https://avatars.githubusercontent.com/u/9101492?v=3","gravatar_id":"","url":"https://api.github.com/users/rgrewalucsb","html_url":"https://github.com/rgrewalucsb","followers_url":"https://api.github.com/users/rgrewalucsb/followers","following_url":"https://api.github.com/users/rgrewalucsb/following{/other_user}","gists_url":"https://api.github.com/users/rgrewalucsb/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrewalucsb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrewalucsb/subscriptions","organizations_url":"https://api.github.com/users/rgrewalucsb/orgs","repos_url":"https://api.github.com/users/rgrewalucsb/repos","events_url":"https://api.github.com/users/rgrewalucsb/events{/privacy}","received_events_url":"https://api.github.com/users/rgrewalucsb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rgrewalucsb/ph2-pA-week-1-passion-project","description":"","fork":true,"url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project","forks_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/forks","keys_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/teams","hooks_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/hooks","issue_events_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/issues/events{/number}","events_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/events","assignees_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/assignees{/user}","branches_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/branches{/branch}","tags_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/tags","blobs_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/statuses/{sha}","languages_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/languages","stargazers_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/stargazers","contributors_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/contributors","subscribers_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/subscribers","subscription_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/subscription","commits_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/issues/comments/{number}","contents_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/contents/{+path}","compare_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/merges","archive_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/downloads","issues_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/issues{/number}","pulls_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/pulls{/number}","milestones_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/milestones{/number}","notifications_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/labels{/name}","releases_url":"https://api.github.com/repos/rgrewalucsb/ph2-pA-week-1-passion-project/releases{/id}","created_at":"2015-02-09T03:04:18Z","updated_at":"2015-02-09T17:00:30Z","pushed_at":"2015-02-09T17:00:30Z","git_url":"git://github.com/rgrewalucsb/ph2-pA-week-1-passion-project.git","ssh_url":"git@github.com:rgrewalucsb/ph2-pA-week-1-passion-project.git","clone_url":"https://github.com/rgrewalucsb/ph2-pA-week-1-passion-project.git","svn_url":"https://github.com/rgrewalucsb/ph2-pA-week-1-passion-project","homepage":null,"size":5068,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sf-squirrels-2015:master","ref":"master","sha":"29609cb497d625caed0bec0fe0d03af9670828bc","user":{"login":"sf-squirrels-2015","id":10455711,"avatar_url":"https://avatars.githubusercontent.com/u/10455711?v=3","gravatar_id":"","url":"https://api.github.com/users/sf-squirrels-2015","html_url":"https://github.com/sf-squirrels-2015","followers_url":"https://api.github.com/users/sf-squirrels-2015/followers","following_url":"https://api.github.com/users/sf-squirrels-2015/following{/other_user}","gists_url":"https://api.github.com/users/sf-squirrels-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/sf-squirrels-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sf-squirrels-2015/subscriptions","organizations_url":"https://api.github.com/users/sf-squirrels-2015/orgs","repos_url":"https://api.github.com/users/sf-squirrels-2015/repos","events_url":"https://api.github.com/users/sf-squirrels-2015/events{/privacy}","received_events_url":"https://api.github.com/users/sf-squirrels-2015/received_events","type":"Organization","site_admin":false},"repo":{"id":30276334,"name":"ph2-pA-week-1-passion-project","full_name":"sf-squirrels-2015/ph2-pA-week-1-passion-project","owner":{"login":"sf-squirrels-2015","id":10455711,"avatar_url":"https://avatars.githubusercontent.com/u/10455711?v=3","gravatar_id":"","url":"https://api.github.com/users/sf-squirrels-2015","html_url":"https://github.com/sf-squirrels-2015","followers_url":"https://api.github.com/users/sf-squirrels-2015/followers","following_url":"https://api.github.com/users/sf-squirrels-2015/following{/other_user}","gists_url":"https://api.github.com/users/sf-squirrels-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/sf-squirrels-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sf-squirrels-2015/subscriptions","organizations_url":"https://api.github.com/users/sf-squirrels-2015/orgs","repos_url":"https://api.github.com/users/sf-squirrels-2015/repos","events_url":"https://api.github.com/users/sf-squirrels-2015/events{/privacy}","received_events_url":"https://api.github.com/users/sf-squirrels-2015/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sf-squirrels-2015/ph2-pA-week-1-passion-project","description":"","fork":false,"url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project","forks_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/forks","keys_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/teams","hooks_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/hooks","issue_events_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/issues/events{/number}","events_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/events","assignees_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/assignees{/user}","branches_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/branches{/branch}","tags_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/tags","blobs_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/statuses/{sha}","languages_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/languages","stargazers_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/stargazers","contributors_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/contributors","subscribers_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/subscribers","subscription_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/subscription","commits_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/issues/comments/{number}","contents_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/contents/{+path}","compare_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/merges","archive_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/downloads","issues_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/issues{/number}","pulls_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls{/number}","milestones_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/milestones{/number}","notifications_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/labels{/name}","releases_url":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/releases{/id}","created_at":"2015-02-04T02:09:34Z","updated_at":"2015-02-04T02:09:34Z","pushed_at":"2015-02-07T21:33:49Z","git_url":"git://github.com/sf-squirrels-2015/ph2-pA-week-1-passion-project.git","ssh_url":"git@github.com:sf-squirrels-2015/ph2-pA-week-1-passion-project.git","clone_url":"https://github.com/sf-squirrels-2015/ph2-pA-week-1-passion-project.git","svn_url":"https://github.com/sf-squirrels-2015/ph2-pA-week-1-passion-project","homepage":null,"size":214,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":20,"forks":19,"open_issues":20,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/18"},"html":{"href":"https://github.com/sf-squirrels-2015/ph2-pA-week-1-passion-project/pull/18"},"issue":{"href":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/issues/18"},"comments":{"href":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/sf-squirrels-2015/ph2-pA-week-1-passion-project/statuses/4df4467c2f6aa0cf87a49172fdd4a2de0eb167bb"}}}}