{"action":"created","comment":{"url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/comments/43613548","id":43613548,"diff_hunk":"@@ -17,11 +17,15 @@ class Comment < ActiveRecord::Base\n   belongs_to :commentable, -> { with_hidden }, polymorphic: true, counter_cache: true\n   belongs_to :user, -> { with_hidden }\n \n-  scope :recent, -> { order(id: :desc) }\n+  before_save :calculate_confidence_score\n+\n   scope :for_render, -> { with_hidden.includes(user: :organization) }\n   scope :with_visible_author, -> { joins(:user).where(\"users.hidden_at IS NULL\") }\n   scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }\n+  scope :sort_by_confidence_score , -> { order(confidence_score: :desc, created_at: :desc) }\n+  scope :sort_descendants_by_confidence_score , -> { order(confidence_score: :desc, created_at: :asc) }\n   scope :sort_by_created_at, -> { order(created_at: :desc) }\n+  scope :sort_descendants_by_created_at, -> { order(created_at: :asc) }","path":"app/models/comment.rb","position":13,"original_position":13,"commit_id":"8dd60b47f649f3ee89f0f6adb3ff172b5f752e09","original_commit_id":"8dd60b47f649f3ee89f0f6adb3ff172b5f752e09","user":{"login":"xuanxu","id":6528,"avatar_url":"https://avatars.githubusercontent.com/u/6528?v=3","gravatar_id":"","url":"https://api.github.com/users/xuanxu","html_url":"https://github.com/xuanxu","followers_url":"https://api.github.com/users/xuanxu/followers","following_url":"https://api.github.com/users/xuanxu/following{/other_user}","gists_url":"https://api.github.com/users/xuanxu/gists{/gist_id}","starred_url":"https://api.github.com/users/xuanxu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xuanxu/subscriptions","organizations_url":"https://api.github.com/users/xuanxu/orgs","repos_url":"https://api.github.com/users/xuanxu/repos","events_url":"https://api.github.com/users/xuanxu/events{/privacy}","received_events_url":"https://api.github.com/users/xuanxu/received_events","type":"User","site_admin":false},"body":"Ya, pero supongo que ahora está así porque no hay distintos criterios de ordenación. \r\nUna vez que metemos las distintas ordenaciones creo que habría que ser consistentes y aplicarlas a todos los niveles, no solo a los root.","created_at":"2015-11-02T10:18:29Z","updated_at":"2015-11-02T10:18:29Z","html_url":"https://github.com/AyuntamientoMadrid/participacion/pull/660#discussion_r43613548","pull_request_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/660","_links":{"self":{"href":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/comments/43613548"},"html":{"href":"https://github.com/AyuntamientoMadrid/participacion/pull/660#discussion_r43613548"},"pull_request":{"href":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/660"}}},"pull_request":{"url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/660","id":49324502,"html_url":"https://github.com/AyuntamientoMadrid/participacion/pull/660","diff_url":"https://github.com/AyuntamientoMadrid/participacion/pull/660.diff","patch_url":"https://github.com/AyuntamientoMadrid/participacion/pull/660.patch","issue_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/issues/660","number":660,"state":"open","locked":false,"title":"Comments order","user":{"login":"kikito","id":63131,"avatar_url":"https://avatars.githubusercontent.com/u/63131?v=3","gravatar_id":"","url":"https://api.github.com/users/kikito","html_url":"https://github.com/kikito","followers_url":"https://api.github.com/users/kikito/followers","following_url":"https://api.github.com/users/kikito/following{/other_user}","gists_url":"https://api.github.com/users/kikito/gists{/gist_id}","starred_url":"https://api.github.com/users/kikito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kikito/subscriptions","organizations_url":"https://api.github.com/users/kikito/orgs","repos_url":"https://api.github.com/users/kikito/repos","events_url":"https://api.github.com/users/kikito/events{/privacy}","received_events_url":"https://api.github.com/users/kikito/received_events","type":"User","site_admin":false},"body":"Allows sorting comments in debates and proposals using a confidence_score.\n\nNote that this PR requires executing `rake comments:confidence_score`.","created_at":"2015-10-30T21:26:57Z","updated_at":"2015-11-02T10:18:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"007c4d31274f3be901b354e0352c2bb7c72640a5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/660/commits","review_comments_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/660/comments","review_comment_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/issues/660/comments","statuses_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/statuses/8dd60b47f649f3ee89f0f6adb3ff172b5f752e09","head":{"label":"AyuntamientoMadrid:comments-order","ref":"comments-order","sha":"8dd60b47f649f3ee89f0f6adb3ff172b5f752e09","user":{"login":"AyuntamientoMadrid","id":13286342,"avatar_url":"https://avatars.githubusercontent.com/u/13286342?v=3","gravatar_id":"","url":"https://api.github.com/users/AyuntamientoMadrid","html_url":"https://github.com/AyuntamientoMadrid","followers_url":"https://api.github.com/users/AyuntamientoMadrid/followers","following_url":"https://api.github.com/users/AyuntamientoMadrid/following{/other_user}","gists_url":"https://api.github.com/users/AyuntamientoMadrid/gists{/gist_id}","starred_url":"https://api.github.com/users/AyuntamientoMadrid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AyuntamientoMadrid/subscriptions","organizations_url":"https://api.github.com/users/AyuntamientoMadrid/orgs","repos_url":"https://api.github.com/users/AyuntamientoMadrid/repos","events_url":"https://api.github.com/users/AyuntamientoMadrid/events{/privacy}","received_events_url":"https://api.github.com/users/AyuntamientoMadrid/received_events","type":"Organization","site_admin":false},"repo":{"id":39152554,"name":"participacion","full_name":"AyuntamientoMadrid/participacion","owner":{"login":"AyuntamientoMadrid","id":13286342,"avatar_url":"https://avatars.githubusercontent.com/u/13286342?v=3","gravatar_id":"","url":"https://api.github.com/users/AyuntamientoMadrid","html_url":"https://github.com/AyuntamientoMadrid","followers_url":"https://api.github.com/users/AyuntamientoMadrid/followers","following_url":"https://api.github.com/users/AyuntamientoMadrid/following{/other_user}","gists_url":"https://api.github.com/users/AyuntamientoMadrid/gists{/gist_id}","starred_url":"https://api.github.com/users/AyuntamientoMadrid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AyuntamientoMadrid/subscriptions","organizations_url":"https://api.github.com/users/AyuntamientoMadrid/orgs","repos_url":"https://api.github.com/users/AyuntamientoMadrid/repos","events_url":"https://api.github.com/users/AyuntamientoMadrid/events{/privacy}","received_events_url":"https://api.github.com/users/AyuntamientoMadrid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AyuntamientoMadrid/participacion","description":"Consul - Gobierno abierto del Ayuntamiento de Madrid","fork":false,"url":"https://api.github.com/repos/AyuntamientoMadrid/participacion","forks_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/forks","keys_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/teams","hooks_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/hooks","issue_events_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/issues/events{/number}","events_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/events","assignees_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/assignees{/user}","branches_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/branches{/branch}","tags_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/tags","blobs_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/git/refs{/sha}","trees_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/statuses/{sha}","languages_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/languages","stargazers_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/stargazers","contributors_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/contributors","subscribers_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/subscribers","subscription_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/subscription","commits_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/commits{/sha}","git_commits_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/git/commits{/sha}","comments_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/comments{/number}","issue_comment_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/issues/comments{/number}","contents_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/contents/{+path}","compare_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/merges","archive_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/downloads","issues_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/issues{/number}","pulls_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls{/number}","milestones_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/milestones{/number}","notifications_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/labels{/name}","releases_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/releases{/id}","created_at":"2015-07-15T18:04:16Z","updated_at":"2015-10-30T07:21:00Z","pushed_at":"2015-11-01T15:14:57Z","git_url":"git://github.com/AyuntamientoMadrid/participacion.git","ssh_url":"git@github.com:AyuntamientoMadrid/participacion.git","clone_url":"https://github.com/AyuntamientoMadrid/participacion.git","svn_url":"https://github.com/AyuntamientoMadrid/participacion","homepage":"https://decide.madrid.es/","size":11055,"stargazers_count":263,"watchers_count":263,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":69,"mirror_url":null,"open_issues_count":31,"forks":69,"open_issues":31,"watchers":263,"default_branch":"master"}},"base":{"label":"AyuntamientoMadrid:master","ref":"master","sha":"36e3ee0c5beced6931872beb5131a378cdeb3c6b","user":{"login":"AyuntamientoMadrid","id":13286342,"avatar_url":"https://avatars.githubusercontent.com/u/13286342?v=3","gravatar_id":"","url":"https://api.github.com/users/AyuntamientoMadrid","html_url":"https://github.com/AyuntamientoMadrid","followers_url":"https://api.github.com/users/AyuntamientoMadrid/followers","following_url":"https://api.github.com/users/AyuntamientoMadrid/following{/other_user}","gists_url":"https://api.github.com/users/AyuntamientoMadrid/gists{/gist_id}","starred_url":"https://api.github.com/users/AyuntamientoMadrid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AyuntamientoMadrid/subscriptions","organizations_url":"https://api.github.com/users/AyuntamientoMadrid/orgs","repos_url":"https://api.github.com/users/AyuntamientoMadrid/repos","events_url":"https://api.github.com/users/AyuntamientoMadrid/events{/privacy}","received_events_url":"https://api.github.com/users/AyuntamientoMadrid/received_events","type":"Organization","site_admin":false},"repo":{"id":39152554,"name":"participacion","full_name":"AyuntamientoMadrid/participacion","owner":{"login":"AyuntamientoMadrid","id":13286342,"avatar_url":"https://avatars.githubusercontent.com/u/13286342?v=3","gravatar_id":"","url":"https://api.github.com/users/AyuntamientoMadrid","html_url":"https://github.com/AyuntamientoMadrid","followers_url":"https://api.github.com/users/AyuntamientoMadrid/followers","following_url":"https://api.github.com/users/AyuntamientoMadrid/following{/other_user}","gists_url":"https://api.github.com/users/AyuntamientoMadrid/gists{/gist_id}","starred_url":"https://api.github.com/users/AyuntamientoMadrid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AyuntamientoMadrid/subscriptions","organizations_url":"https://api.github.com/users/AyuntamientoMadrid/orgs","repos_url":"https://api.github.com/users/AyuntamientoMadrid/repos","events_url":"https://api.github.com/users/AyuntamientoMadrid/events{/privacy}","received_events_url":"https://api.github.com/users/AyuntamientoMadrid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AyuntamientoMadrid/participacion","description":"Consul - Gobierno abierto del Ayuntamiento de Madrid","fork":false,"url":"https://api.github.com/repos/AyuntamientoMadrid/participacion","forks_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/forks","keys_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/teams","hooks_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/hooks","issue_events_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/issues/events{/number}","events_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/events","assignees_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/assignees{/user}","branches_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/branches{/branch}","tags_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/tags","blobs_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/git/refs{/sha}","trees_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/statuses/{sha}","languages_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/languages","stargazers_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/stargazers","contributors_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/contributors","subscribers_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/subscribers","subscription_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/subscription","commits_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/commits{/sha}","git_commits_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/git/commits{/sha}","comments_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/comments{/number}","issue_comment_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/issues/comments{/number}","contents_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/contents/{+path}","compare_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/merges","archive_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/downloads","issues_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/issues{/number}","pulls_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls{/number}","milestones_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/milestones{/number}","notifications_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/labels{/name}","releases_url":"https://api.github.com/repos/AyuntamientoMadrid/participacion/releases{/id}","created_at":"2015-07-15T18:04:16Z","updated_at":"2015-10-30T07:21:00Z","pushed_at":"2015-11-01T15:14:57Z","git_url":"git://github.com/AyuntamientoMadrid/participacion.git","ssh_url":"git@github.com:AyuntamientoMadrid/participacion.git","clone_url":"https://github.com/AyuntamientoMadrid/participacion.git","svn_url":"https://github.com/AyuntamientoMadrid/participacion","homepage":"https://decide.madrid.es/","size":11055,"stargazers_count":263,"watchers_count":263,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":69,"mirror_url":null,"open_issues_count":31,"forks":69,"open_issues":31,"watchers":263,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/660"},"html":{"href":"https://github.com/AyuntamientoMadrid/participacion/pull/660"},"issue":{"href":"https://api.github.com/repos/AyuntamientoMadrid/participacion/issues/660"},"comments":{"href":"https://api.github.com/repos/AyuntamientoMadrid/participacion/issues/660/comments"},"review_comments":{"href":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/660/comments"},"review_comment":{"href":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AyuntamientoMadrid/participacion/pulls/660/commits"},"statuses":{"href":"https://api.github.com/repos/AyuntamientoMadrid/participacion/statuses/8dd60b47f649f3ee89f0f6adb3ff172b5f752e09"}}}}