{"action":"opened","number":28,"pull_request":{"url":"https://api.github.com/repos/nhsalpha/gp-lookup/pulls/28","id":62387666,"html_url":"https://github.com/nhsalpha/gp-lookup/pull/28","diff_url":"https://github.com/nhsalpha/gp-lookup/pull/28.diff","patch_url":"https://github.com/nhsalpha/gp-lookup/pull/28.patch","issue_url":"https://api.github.com/repos/nhsalpha/gp-lookup/issues/28","number":28,"state":"open","locked":false,"title":"Make result ordering more stable","user":{"login":"evilstreak","id":74812,"avatar_url":"https://avatars.githubusercontent.com/u/74812?v=3","gravatar_id":"","url":"https://api.github.com/users/evilstreak","html_url":"https://github.com/evilstreak","followers_url":"https://api.github.com/users/evilstreak/followers","following_url":"https://api.github.com/users/evilstreak/following{/other_user}","gists_url":"https://api.github.com/users/evilstreak/gists{/gist_id}","starred_url":"https://api.github.com/users/evilstreak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evilstreak/subscriptions","organizations_url":"https://api.github.com/users/evilstreak/orgs","repos_url":"https://api.github.com/users/evilstreak/repos","events_url":"https://api.github.com/users/evilstreak/events{/privacy}","received_events_url":"https://api.github.com/users/evilstreak/received_events","type":"User","site_admin":false},"body":"Ruby's `Enumerable#sort` method is unstable (it uses qsort under the hood). As a result, the order of results with the same score can change depending on the total length of the list, due to the different order and number of comparisons.\r\n\r\nWhen we load a new page of results to show 40 instead of 20, the top 20 may not be in the same order as they were previously. That gives a really weird visual jitter, and makes paging through results a pretty awful experience.\r\n\r\nWhen sorting include the original index for comparison so the results stay stable.\r\n\r\nThis is a bit of hack, but it's good enough for now. It doesn't resolve issues with a result's score changing as more results get included, nor with GP names being added to existing results, changing the amount of space they take up on screen.","created_at":"2016-03-10T13:15:43Z","updated_at":"2016-03-10T13:15:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nhsalpha/gp-lookup/pulls/28/commits","review_comments_url":"https://api.github.com/repos/nhsalpha/gp-lookup/pulls/28/comments","review_comment_url":"https://api.github.com/repos/nhsalpha/gp-lookup/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nhsalpha/gp-lookup/issues/28/comments","statuses_url":"https://api.github.com/repos/nhsalpha/gp-lookup/statuses/42e044d1f9d853efb96cecad270e3cbfd885621c","head":{"label":"nhsalpha:fix-ordering","ref":"fix-ordering","sha":"42e044d1f9d853efb96cecad270e3cbfd885621c","user":{"login":"nhsalpha","id":12557899,"avatar_url":"https://avatars.githubusercontent.com/u/12557899?v=3","gravatar_id":"","url":"https://api.github.com/users/nhsalpha","html_url":"https://github.com/nhsalpha","followers_url":"https://api.github.com/users/nhsalpha/followers","following_url":"https://api.github.com/users/nhsalpha/following{/other_user}","gists_url":"https://api.github.com/users/nhsalpha/gists{/gist_id}","starred_url":"https://api.github.com/users/nhsalpha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhsalpha/subscriptions","organizations_url":"https://api.github.com/users/nhsalpha/orgs","repos_url":"https://api.github.com/users/nhsalpha/repos","events_url":"https://api.github.com/users/nhsalpha/events{/privacy}","received_events_url":"https://api.github.com/users/nhsalpha/received_events","type":"Organization","site_admin":false},"repo":{"id":50523393,"name":"gp-lookup","full_name":"nhsalpha/gp-lookup","owner":{"login":"nhsalpha","id":12557899,"avatar_url":"https://avatars.githubusercontent.com/u/12557899?v=3","gravatar_id":"","url":"https://api.github.com/users/nhsalpha","html_url":"https://github.com/nhsalpha","followers_url":"https://api.github.com/users/nhsalpha/followers","following_url":"https://api.github.com/users/nhsalpha/following{/other_user}","gists_url":"https://api.github.com/users/nhsalpha/gists{/gist_id}","starred_url":"https://api.github.com/users/nhsalpha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhsalpha/subscriptions","organizations_url":"https://api.github.com/users/nhsalpha/orgs","repos_url":"https://api.github.com/users/nhsalpha/repos","events_url":"https://api.github.com/users/nhsalpha/events{/privacy}","received_events_url":"https://api.github.com/users/nhsalpha/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nhsalpha/gp-lookup","description":"","fork":false,"url":"https://api.github.com/repos/nhsalpha/gp-lookup","forks_url":"https://api.github.com/repos/nhsalpha/gp-lookup/forks","keys_url":"https://api.github.com/repos/nhsalpha/gp-lookup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nhsalpha/gp-lookup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nhsalpha/gp-lookup/teams","hooks_url":"https://api.github.com/repos/nhsalpha/gp-lookup/hooks","issue_events_url":"https://api.github.com/repos/nhsalpha/gp-lookup/issues/events{/number}","events_url":"https://api.github.com/repos/nhsalpha/gp-lookup/events","assignees_url":"https://api.github.com/repos/nhsalpha/gp-lookup/assignees{/user}","branches_url":"https://api.github.com/repos/nhsalpha/gp-lookup/branches{/branch}","tags_url":"https://api.github.com/repos/nhsalpha/gp-lookup/tags","blobs_url":"https://api.github.com/repos/nhsalpha/gp-lookup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nhsalpha/gp-lookup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nhsalpha/gp-lookup/git/refs{/sha}","trees_url":"https://api.github.com/repos/nhsalpha/gp-lookup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nhsalpha/gp-lookup/statuses/{sha}","languages_url":"https://api.github.com/repos/nhsalpha/gp-lookup/languages","stargazers_url":"https://api.github.com/repos/nhsalpha/gp-lookup/stargazers","contributors_url":"https://api.github.com/repos/nhsalpha/gp-lookup/contributors","subscribers_url":"https://api.github.com/repos/nhsalpha/gp-lookup/subscribers","subscription_url":"https://api.github.com/repos/nhsalpha/gp-lookup/subscription","commits_url":"https://api.github.com/repos/nhsalpha/gp-lookup/commits{/sha}","git_commits_url":"https://api.github.com/repos/nhsalpha/gp-lookup/git/commits{/sha}","comments_url":"https://api.github.com/repos/nhsalpha/gp-lookup/comments{/number}","issue_comment_url":"https://api.github.com/repos/nhsalpha/gp-lookup/issues/comments{/number}","contents_url":"https://api.github.com/repos/nhsalpha/gp-lookup/contents/{+path}","compare_url":"https://api.github.com/repos/nhsalpha/gp-lookup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nhsalpha/gp-lookup/merges","archive_url":"https://api.github.com/repos/nhsalpha/gp-lookup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nhsalpha/gp-lookup/downloads","issues_url":"https://api.github.com/repos/nhsalpha/gp-lookup/issues{/number}","pulls_url":"https://api.github.com/repos/nhsalpha/gp-lookup/pulls{/number}","milestones_url":"https://api.github.com/repos/nhsalpha/gp-lookup/milestones{/number}","notifications_url":"https://api.github.com/repos/nhsalpha/gp-lookup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nhsalpha/gp-lookup/labels{/name}","releases_url":"https://api.github.com/repos/nhsalpha/gp-lookup/releases{/id}","deployments_url":"https://api.github.com/repos/nhsalpha/gp-lookup/deployments","created_at":"2016-01-27T17:08:08Z","updated_at":"2016-01-27T17:08:36Z","pushed_at":"2016-03-10T13:15:43Z","git_url":"git://github.com/nhsalpha/gp-lookup.git","ssh_url":"git@github.com:nhsalpha/gp-lookup.git","clone_url":"https://github.com/nhsalpha/gp-lookup.git","svn_url":"https://github.com/nhsalpha/gp-lookup","homepage":null,"size":3497,"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":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"nhsalpha:master","ref":"master","sha":"d34b2ed7baad68f83168b6089d3112a4f56649e7","user":{"login":"nhsalpha","id":12557899,"avatar_url":"https://avatars.githubusercontent.com/u/12557899?v=3","gravatar_id":"","url":"https://api.github.com/users/nhsalpha","html_url":"https://github.com/nhsalpha","followers_url":"https://api.github.com/users/nhsalpha/followers","following_url":"https://api.github.com/users/nhsalpha/following{/other_user}","gists_url":"https://api.github.com/users/nhsalpha/gists{/gist_id}","starred_url":"https://api.github.com/users/nhsalpha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhsalpha/subscriptions","organizations_url":"https://api.github.com/users/nhsalpha/orgs","repos_url":"https://api.github.com/users/nhsalpha/repos","events_url":"https://api.github.com/users/nhsalpha/events{/privacy}","received_events_url":"https://api.github.com/users/nhsalpha/received_events","type":"Organization","site_admin":false},"repo":{"id":50523393,"name":"gp-lookup","full_name":"nhsalpha/gp-lookup","owner":{"login":"nhsalpha","id":12557899,"avatar_url":"https://avatars.githubusercontent.com/u/12557899?v=3","gravatar_id":"","url":"https://api.github.com/users/nhsalpha","html_url":"https://github.com/nhsalpha","followers_url":"https://api.github.com/users/nhsalpha/followers","following_url":"https://api.github.com/users/nhsalpha/following{/other_user}","gists_url":"https://api.github.com/users/nhsalpha/gists{/gist_id}","starred_url":"https://api.github.com/users/nhsalpha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhsalpha/subscriptions","organizations_url":"https://api.github.com/users/nhsalpha/orgs","repos_url":"https://api.github.com/users/nhsalpha/repos","events_url":"https://api.github.com/users/nhsalpha/events{/privacy}","received_events_url":"https://api.github.com/users/nhsalpha/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nhsalpha/gp-lookup","description":"","fork":false,"url":"https://api.github.com/repos/nhsalpha/gp-lookup","forks_url":"https://api.github.com/repos/nhsalpha/gp-lookup/forks","keys_url":"https://api.github.com/repos/nhsalpha/gp-lookup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nhsalpha/gp-lookup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nhsalpha/gp-lookup/teams","hooks_url":"https://api.github.com/repos/nhsalpha/gp-lookup/hooks","issue_events_url":"https://api.github.com/repos/nhsalpha/gp-lookup/issues/events{/number}","events_url":"https://api.github.com/repos/nhsalpha/gp-lookup/events","assignees_url":"https://api.github.com/repos/nhsalpha/gp-lookup/assignees{/user}","branches_url":"https://api.github.com/repos/nhsalpha/gp-lookup/branches{/branch}","tags_url":"https://api.github.com/repos/nhsalpha/gp-lookup/tags","blobs_url":"https://api.github.com/repos/nhsalpha/gp-lookup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nhsalpha/gp-lookup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nhsalpha/gp-lookup/git/refs{/sha}","trees_url":"https://api.github.com/repos/nhsalpha/gp-lookup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nhsalpha/gp-lookup/statuses/{sha}","languages_url":"https://api.github.com/repos/nhsalpha/gp-lookup/languages","stargazers_url":"https://api.github.com/repos/nhsalpha/gp-lookup/stargazers","contributors_url":"https://api.github.com/repos/nhsalpha/gp-lookup/contributors","subscribers_url":"https://api.github.com/repos/nhsalpha/gp-lookup/subscribers","subscription_url":"https://api.github.com/repos/nhsalpha/gp-lookup/subscription","commits_url":"https://api.github.com/repos/nhsalpha/gp-lookup/commits{/sha}","git_commits_url":"https://api.github.com/repos/nhsalpha/gp-lookup/git/commits{/sha}","comments_url":"https://api.github.com/repos/nhsalpha/gp-lookup/comments{/number}","issue_comment_url":"https://api.github.com/repos/nhsalpha/gp-lookup/issues/comments{/number}","contents_url":"https://api.github.com/repos/nhsalpha/gp-lookup/contents/{+path}","compare_url":"https://api.github.com/repos/nhsalpha/gp-lookup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nhsalpha/gp-lookup/merges","archive_url":"https://api.github.com/repos/nhsalpha/gp-lookup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nhsalpha/gp-lookup/downloads","issues_url":"https://api.github.com/repos/nhsalpha/gp-lookup/issues{/number}","pulls_url":"https://api.github.com/repos/nhsalpha/gp-lookup/pulls{/number}","milestones_url":"https://api.github.com/repos/nhsalpha/gp-lookup/milestones{/number}","notifications_url":"https://api.github.com/repos/nhsalpha/gp-lookup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nhsalpha/gp-lookup/labels{/name}","releases_url":"https://api.github.com/repos/nhsalpha/gp-lookup/releases{/id}","deployments_url":"https://api.github.com/repos/nhsalpha/gp-lookup/deployments","created_at":"2016-01-27T17:08:08Z","updated_at":"2016-01-27T17:08:36Z","pushed_at":"2016-03-10T13:15:43Z","git_url":"git://github.com/nhsalpha/gp-lookup.git","ssh_url":"git@github.com:nhsalpha/gp-lookup.git","clone_url":"https://github.com/nhsalpha/gp-lookup.git","svn_url":"https://github.com/nhsalpha/gp-lookup","homepage":null,"size":3497,"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":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nhsalpha/gp-lookup/pulls/28"},"html":{"href":"https://github.com/nhsalpha/gp-lookup/pull/28"},"issue":{"href":"https://api.github.com/repos/nhsalpha/gp-lookup/issues/28"},"comments":{"href":"https://api.github.com/repos/nhsalpha/gp-lookup/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/nhsalpha/gp-lookup/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/nhsalpha/gp-lookup/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nhsalpha/gp-lookup/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/nhsalpha/gp-lookup/statuses/42e044d1f9d853efb96cecad270e3cbfd885621c"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":37,"deletions":25,"changed_files":1}}