{"action":"created","comment":{"url":"https://api.github.com/repos/ABBennett/break_toy/pulls/comments/50933807","id":50933807,"diff_hunk":"@@ -1,8 +1,23 @@\n class ConversationsController < ApplicationController\n   before_action :signed_in_flash, only: [:create]\n   # before_action :participant?, only: [:show]\n+\n   def index\n-    @conversations = Conversation.all.order(\"created_at DESC\")\n+    if params[:order] == \"totalpoints\"\n+      @conversations = Kaminari.paginate_array(Conversation.all.sort{ |b,a| a.sender.average_score + a.recipient.average_score <=> b.sender.average_score + b.recipient.average_score }).page(params[:page]).per(10)\n+    elsif params[:order] == \"message\"\n+        @conversations = Kaminari.paginate_array(Conversation.all.sort{ |b,a| a.messages.count <=> b.messages.count }).page(params[:page]).per(10)\n+    elsif params[:order] == \"points\"\n+        @conversations = Kaminari.paginate_array(Conversation.all.sort{ |b,a| a.sender.total + a.recipient.total <=> b.sender.total + b.recipient.total }).page(params[:page]).per(10)\n+    elsif params[:order] == \"sender\"\n+      @conversations = Kaminari.paginate_array(Conversation.all.sort{ |b,a| a.sender.average_score || a.recipient.average_score <=> b.sender.average_score || b.recipient.average_score }).page(params[:page]).per(10)\n+    elsif params[:order] == \"recipient\"\n+        @conversations = Kaminari.paginate_array(Conversation.all.sort{ |b,a| a.recipient.average_score <=> b.recipient.average_score }).page(params[:page]).per(10)","path":"app/controllers/conversations_controller.rb","position":16,"original_position":16,"commit_id":"48383548fa1bf218239edc2481e648c6bb6cffe4","original_commit_id":"48383548fa1bf218239edc2481e648c6bb6cffe4","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Line is too long. [164/80]<br>Use 2 (not 4) spaces for indentation.<br>Space missing after comma.<br>Space missing to the left of {.","created_at":"2016-01-27T02:22:46Z","updated_at":"2016-01-27T02:22:46Z","html_url":"https://github.com/ABBennett/break_toy/pull/25#discussion_r50933807","pull_request_url":"https://api.github.com/repos/ABBennett/break_toy/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/ABBennett/break_toy/pulls/comments/50933807"},"html":{"href":"https://github.com/ABBennett/break_toy/pull/25#discussion_r50933807"},"pull_request":{"href":"https://api.github.com/repos/ABBennett/break_toy/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/ABBennett/break_toy/pulls/25","id":57304987,"html_url":"https://github.com/ABBennett/break_toy/pull/25","diff_url":"https://github.com/ABBennett/break_toy/pull/25.diff","patch_url":"https://github.com/ABBennett/break_toy/pull/25.patch","issue_url":"https://api.github.com/repos/ABBennett/break_toy/issues/25","number":25,"state":"open","locked":false,"title":"pagination working now for some reason...","user":{"login":"ABBennett","id":13205479,"avatar_url":"https://avatars.githubusercontent.com/u/13205479?v=3","gravatar_id":"","url":"https://api.github.com/users/ABBennett","html_url":"https://github.com/ABBennett","followers_url":"https://api.github.com/users/ABBennett/followers","following_url":"https://api.github.com/users/ABBennett/following{/other_user}","gists_url":"https://api.github.com/users/ABBennett/gists{/gist_id}","starred_url":"https://api.github.com/users/ABBennett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ABBennett/subscriptions","organizations_url":"https://api.github.com/users/ABBennett/orgs","repos_url":"https://api.github.com/users/ABBennett/repos","events_url":"https://api.github.com/users/ABBennett/events{/privacy}","received_events_url":"https://api.github.com/users/ABBennett/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-27T02:22:43Z","updated_at":"2016-01-27T02:22:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d2a88c793af5cef626f429f0e33d76b7afff0bdf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ABBennett/break_toy/pulls/25/commits","review_comments_url":"https://api.github.com/repos/ABBennett/break_toy/pulls/25/comments","review_comment_url":"https://api.github.com/repos/ABBennett/break_toy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ABBennett/break_toy/issues/25/comments","statuses_url":"https://api.github.com/repos/ABBennett/break_toy/statuses/48383548fa1bf218239edc2481e648c6bb6cffe4","head":{"label":"ABBennett:convo_sort2","ref":"convo_sort2","sha":"48383548fa1bf218239edc2481e648c6bb6cffe4","user":{"login":"ABBennett","id":13205479,"avatar_url":"https://avatars.githubusercontent.com/u/13205479?v=3","gravatar_id":"","url":"https://api.github.com/users/ABBennett","html_url":"https://github.com/ABBennett","followers_url":"https://api.github.com/users/ABBennett/followers","following_url":"https://api.github.com/users/ABBennett/following{/other_user}","gists_url":"https://api.github.com/users/ABBennett/gists{/gist_id}","starred_url":"https://api.github.com/users/ABBennett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ABBennett/subscriptions","organizations_url":"https://api.github.com/users/ABBennett/orgs","repos_url":"https://api.github.com/users/ABBennett/repos","events_url":"https://api.github.com/users/ABBennett/events{/privacy}","received_events_url":"https://api.github.com/users/ABBennett/received_events","type":"User","site_admin":false},"repo":{"id":49824646,"name":"break_toy","full_name":"ABBennett/break_toy","owner":{"login":"ABBennett","id":13205479,"avatar_url":"https://avatars.githubusercontent.com/u/13205479?v=3","gravatar_id":"","url":"https://api.github.com/users/ABBennett","html_url":"https://github.com/ABBennett","followers_url":"https://api.github.com/users/ABBennett/followers","following_url":"https://api.github.com/users/ABBennett/following{/other_user}","gists_url":"https://api.github.com/users/ABBennett/gists{/gist_id}","starred_url":"https://api.github.com/users/ABBennett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ABBennett/subscriptions","organizations_url":"https://api.github.com/users/ABBennett/orgs","repos_url":"https://api.github.com/users/ABBennett/repos","events_url":"https://api.github.com/users/ABBennett/events{/privacy}","received_events_url":"https://api.github.com/users/ABBennett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ABBennett/break_toy","description":null,"fork":false,"url":"https://api.github.com/repos/ABBennett/break_toy","forks_url":"https://api.github.com/repos/ABBennett/break_toy/forks","keys_url":"https://api.github.com/repos/ABBennett/break_toy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ABBennett/break_toy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ABBennett/break_toy/teams","hooks_url":"https://api.github.com/repos/ABBennett/break_toy/hooks","issue_events_url":"https://api.github.com/repos/ABBennett/break_toy/issues/events{/number}","events_url":"https://api.github.com/repos/ABBennett/break_toy/events","assignees_url":"https://api.github.com/repos/ABBennett/break_toy/assignees{/user}","branches_url":"https://api.github.com/repos/ABBennett/break_toy/branches{/branch}","tags_url":"https://api.github.com/repos/ABBennett/break_toy/tags","blobs_url":"https://api.github.com/repos/ABBennett/break_toy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ABBennett/break_toy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ABBennett/break_toy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ABBennett/break_toy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ABBennett/break_toy/statuses/{sha}","languages_url":"https://api.github.com/repos/ABBennett/break_toy/languages","stargazers_url":"https://api.github.com/repos/ABBennett/break_toy/stargazers","contributors_url":"https://api.github.com/repos/ABBennett/break_toy/contributors","subscribers_url":"https://api.github.com/repos/ABBennett/break_toy/subscribers","subscription_url":"https://api.github.com/repos/ABBennett/break_toy/subscription","commits_url":"https://api.github.com/repos/ABBennett/break_toy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ABBennett/break_toy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ABBennett/break_toy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ABBennett/break_toy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ABBennett/break_toy/contents/{+path}","compare_url":"https://api.github.com/repos/ABBennett/break_toy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ABBennett/break_toy/merges","archive_url":"https://api.github.com/repos/ABBennett/break_toy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ABBennett/break_toy/downloads","issues_url":"https://api.github.com/repos/ABBennett/break_toy/issues{/number}","pulls_url":"https://api.github.com/repos/ABBennett/break_toy/pulls{/number}","milestones_url":"https://api.github.com/repos/ABBennett/break_toy/milestones{/number}","notifications_url":"https://api.github.com/repos/ABBennett/break_toy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ABBennett/break_toy/labels{/name}","releases_url":"https://api.github.com/repos/ABBennett/break_toy/releases{/id}","deployments_url":"https://api.github.com/repos/ABBennett/break_toy/deployments","created_at":"2016-01-17T16:11:16Z","updated_at":"2016-01-17T16:11:24Z","pushed_at":"2016-01-27T02:22:43Z","git_url":"git://github.com/ABBennett/break_toy.git","ssh_url":"git@github.com:ABBennett/break_toy.git","clone_url":"https://github.com/ABBennett/break_toy.git","svn_url":"https://github.com/ABBennett/break_toy","homepage":null,"size":215,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"ABBennett:master","ref":"master","sha":"bb86a5426440ce6e251b9bb7411e8cb66bf26eb0","user":{"login":"ABBennett","id":13205479,"avatar_url":"https://avatars.githubusercontent.com/u/13205479?v=3","gravatar_id":"","url":"https://api.github.com/users/ABBennett","html_url":"https://github.com/ABBennett","followers_url":"https://api.github.com/users/ABBennett/followers","following_url":"https://api.github.com/users/ABBennett/following{/other_user}","gists_url":"https://api.github.com/users/ABBennett/gists{/gist_id}","starred_url":"https://api.github.com/users/ABBennett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ABBennett/subscriptions","organizations_url":"https://api.github.com/users/ABBennett/orgs","repos_url":"https://api.github.com/users/ABBennett/repos","events_url":"https://api.github.com/users/ABBennett/events{/privacy}","received_events_url":"https://api.github.com/users/ABBennett/received_events","type":"User","site_admin":false},"repo":{"id":49824646,"name":"break_toy","full_name":"ABBennett/break_toy","owner":{"login":"ABBennett","id":13205479,"avatar_url":"https://avatars.githubusercontent.com/u/13205479?v=3","gravatar_id":"","url":"https://api.github.com/users/ABBennett","html_url":"https://github.com/ABBennett","followers_url":"https://api.github.com/users/ABBennett/followers","following_url":"https://api.github.com/users/ABBennett/following{/other_user}","gists_url":"https://api.github.com/users/ABBennett/gists{/gist_id}","starred_url":"https://api.github.com/users/ABBennett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ABBennett/subscriptions","organizations_url":"https://api.github.com/users/ABBennett/orgs","repos_url":"https://api.github.com/users/ABBennett/repos","events_url":"https://api.github.com/users/ABBennett/events{/privacy}","received_events_url":"https://api.github.com/users/ABBennett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ABBennett/break_toy","description":null,"fork":false,"url":"https://api.github.com/repos/ABBennett/break_toy","forks_url":"https://api.github.com/repos/ABBennett/break_toy/forks","keys_url":"https://api.github.com/repos/ABBennett/break_toy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ABBennett/break_toy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ABBennett/break_toy/teams","hooks_url":"https://api.github.com/repos/ABBennett/break_toy/hooks","issue_events_url":"https://api.github.com/repos/ABBennett/break_toy/issues/events{/number}","events_url":"https://api.github.com/repos/ABBennett/break_toy/events","assignees_url":"https://api.github.com/repos/ABBennett/break_toy/assignees{/user}","branches_url":"https://api.github.com/repos/ABBennett/break_toy/branches{/branch}","tags_url":"https://api.github.com/repos/ABBennett/break_toy/tags","blobs_url":"https://api.github.com/repos/ABBennett/break_toy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ABBennett/break_toy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ABBennett/break_toy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ABBennett/break_toy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ABBennett/break_toy/statuses/{sha}","languages_url":"https://api.github.com/repos/ABBennett/break_toy/languages","stargazers_url":"https://api.github.com/repos/ABBennett/break_toy/stargazers","contributors_url":"https://api.github.com/repos/ABBennett/break_toy/contributors","subscribers_url":"https://api.github.com/repos/ABBennett/break_toy/subscribers","subscription_url":"https://api.github.com/repos/ABBennett/break_toy/subscription","commits_url":"https://api.github.com/repos/ABBennett/break_toy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ABBennett/break_toy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ABBennett/break_toy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ABBennett/break_toy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ABBennett/break_toy/contents/{+path}","compare_url":"https://api.github.com/repos/ABBennett/break_toy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ABBennett/break_toy/merges","archive_url":"https://api.github.com/repos/ABBennett/break_toy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ABBennett/break_toy/downloads","issues_url":"https://api.github.com/repos/ABBennett/break_toy/issues{/number}","pulls_url":"https://api.github.com/repos/ABBennett/break_toy/pulls{/number}","milestones_url":"https://api.github.com/repos/ABBennett/break_toy/milestones{/number}","notifications_url":"https://api.github.com/repos/ABBennett/break_toy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ABBennett/break_toy/labels{/name}","releases_url":"https://api.github.com/repos/ABBennett/break_toy/releases{/id}","deployments_url":"https://api.github.com/repos/ABBennett/break_toy/deployments","created_at":"2016-01-17T16:11:16Z","updated_at":"2016-01-17T16:11:24Z","pushed_at":"2016-01-27T02:22:43Z","git_url":"git://github.com/ABBennett/break_toy.git","ssh_url":"git@github.com:ABBennett/break_toy.git","clone_url":"https://github.com/ABBennett/break_toy.git","svn_url":"https://github.com/ABBennett/break_toy","homepage":null,"size":215,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ABBennett/break_toy/pulls/25"},"html":{"href":"https://github.com/ABBennett/break_toy/pull/25"},"issue":{"href":"https://api.github.com/repos/ABBennett/break_toy/issues/25"},"comments":{"href":"https://api.github.com/repos/ABBennett/break_toy/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/ABBennett/break_toy/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/ABBennett/break_toy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ABBennett/break_toy/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/ABBennett/break_toy/statuses/48383548fa1bf218239edc2481e648c6bb6cffe4"}}}}