{"action":"closed","number":2805,"pull_request":{"url":"https://api.github.com/repos/zooniverse/Panoptes/pulls/2805","id":194640468,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0NjQwNDY4","html_url":"https://github.com/zooniverse/Panoptes/pull/2805","diff_url":"https://github.com/zooniverse/Panoptes/pull/2805.diff","patch_url":"https://github.com/zooniverse/Panoptes/pull/2805.patch","issue_url":"https://api.github.com/repos/zooniverse/Panoptes/issues/2805","number":2805,"state":"closed","locked":false,"title":"Optimize subject selection paths","user":{"login":"camallen","id":295329,"node_id":"MDQ6VXNlcjI5NTMyOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/295329?v=4","gravatar_id":"","url":"https://api.github.com/users/camallen","html_url":"https://github.com/camallen","followers_url":"https://api.github.com/users/camallen/followers","following_url":"https://api.github.com/users/camallen/following{/other_user}","gists_url":"https://api.github.com/users/camallen/gists{/gist_id}","starred_url":"https://api.github.com/users/camallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camallen/subscriptions","organizations_url":"https://api.github.com/users/camallen/orgs","repos_url":"https://api.github.com/users/camallen/repos","events_url":"https://api.github.com/users/camallen/events{/privacy}","received_events_url":"https://api.github.com/users/camallen/received_events","type":"User","site_admin":false},"body":"Linked to #2804 - Avoid as much work as possible during subject selection including the custom selection context response. \r\n\r\nI've audited the queries to determine seens / fav, retired and left them intact as they are fast as they are.\r\n\r\nI did find what i think is a better way of determining if the user has finished a workflow, vs counting the number of available linked subjects taking into account what the user has seen. Instead of counting we can use the selector responses to proxy this information. I.e. if designator returns data we can assume that the user has not finished the workflow, same for internal selector but if it reaches the any data fallback we assume they are finished. i have also taken into account when the external selector returns all retired/seen data then we assume that the user has finished the workflow until selector reloads data in time. \r\n\r\nI found an optimization to short circut the selection paths if the workflow is finished, we used to run the internal fallback and then any data, now it just runs the any data. \r\n\r\nFinally I refactored how the serializer constructs this selection context and update specs away from controllers. \r\n\r\n# Review checklist\r\n\r\n- [ ] First, the most important one: is this PR small enough that you can actually review it? Feel free to just reject a branch if the changes are hard to review due to the length of the diff.\r\n- [ ] If there are any migrations, will they the previous version of the app work correctly after they've been run (e.g. the don't remove columns still known about by ActiveRecord).\r\n- [ ] If anything changed with regards to the public API, are those changes also documented in the `apiary.apib` file?\r\n- [ ] Are all the changes covered by tests? Think about any possible edge cases that might be left untested.\r\n","created_at":"2018-06-13T16:11:32Z","updated_at":"2018-06-26T14:42:53Z","closed_at":"2018-06-26T14:42:53Z","merged_at":"2018-06-26T14:42:53Z","merge_commit_sha":"0e9e0904d92d9bc8fab8c1de37d13f27439f23dc","assignee":null,"assignees":[],"requested_reviewers":[{"login":"zwolf","id":374835,"node_id":"MDQ6VXNlcjM3NDgzNQ==","avatar_url":"https://avatars2.githubusercontent.com/u/374835?v=4","gravatar_id":"","url":"https://api.github.com/users/zwolf","html_url":"https://github.com/zwolf","followers_url":"https://api.github.com/users/zwolf/followers","following_url":"https://api.github.com/users/zwolf/following{/other_user}","gists_url":"https://api.github.com/users/zwolf/gists{/gist_id}","starred_url":"https://api.github.com/users/zwolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zwolf/subscriptions","organizations_url":"https://api.github.com/users/zwolf/orgs","repos_url":"https://api.github.com/users/zwolf/repos","events_url":"https://api.github.com/users/zwolf/events{/privacy}","received_events_url":"https://api.github.com/users/zwolf/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zooniverse/Panoptes/pulls/2805/commits","review_comments_url":"https://api.github.com/repos/zooniverse/Panoptes/pulls/2805/comments","review_comment_url":"https://api.github.com/repos/zooniverse/Panoptes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zooniverse/Panoptes/issues/2805/comments","statuses_url":"https://api.github.com/repos/zooniverse/Panoptes/statuses/a87b063b46d055524f2094fa43773238c7df73ca","head":{"label":"camallen:optimize_subject_selection","ref":"optimize_subject_selection","sha":"a87b063b46d055524f2094fa43773238c7df73ca","user":{"login":"camallen","id":295329,"node_id":"MDQ6VXNlcjI5NTMyOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/295329?v=4","gravatar_id":"","url":"https://api.github.com/users/camallen","html_url":"https://github.com/camallen","followers_url":"https://api.github.com/users/camallen/followers","following_url":"https://api.github.com/users/camallen/following{/other_user}","gists_url":"https://api.github.com/users/camallen/gists{/gist_id}","starred_url":"https://api.github.com/users/camallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camallen/subscriptions","organizations_url":"https://api.github.com/users/camallen/orgs","repos_url":"https://api.github.com/users/camallen/repos","events_url":"https://api.github.com/users/camallen/events{/privacy}","received_events_url":"https://api.github.com/users/camallen/received_events","type":"User","site_admin":false},"repo":{"id":20215459,"node_id":"MDEwOlJlcG9zaXRvcnkyMDIxNTQ1OQ==","name":"Panoptes","full_name":"camallen/Panoptes","owner":{"login":"camallen","id":295329,"node_id":"MDQ6VXNlcjI5NTMyOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/295329?v=4","gravatar_id":"","url":"https://api.github.com/users/camallen","html_url":"https://github.com/camallen","followers_url":"https://api.github.com/users/camallen/followers","following_url":"https://api.github.com/users/camallen/following{/other_user}","gists_url":"https://api.github.com/users/camallen/gists{/gist_id}","starred_url":"https://api.github.com/users/camallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camallen/subscriptions","organizations_url":"https://api.github.com/users/camallen/orgs","repos_url":"https://api.github.com/users/camallen/repos","events_url":"https://api.github.com/users/camallen/events{/privacy}","received_events_url":"https://api.github.com/users/camallen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/camallen/Panoptes","description":"It sees everything","fork":true,"url":"https://api.github.com/repos/camallen/Panoptes","forks_url":"https://api.github.com/repos/camallen/Panoptes/forks","keys_url":"https://api.github.com/repos/camallen/Panoptes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/camallen/Panoptes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/camallen/Panoptes/teams","hooks_url":"https://api.github.com/repos/camallen/Panoptes/hooks","issue_events_url":"https://api.github.com/repos/camallen/Panoptes/issues/events{/number}","events_url":"https://api.github.com/repos/camallen/Panoptes/events","assignees_url":"https://api.github.com/repos/camallen/Panoptes/assignees{/user}","branches_url":"https://api.github.com/repos/camallen/Panoptes/branches{/branch}","tags_url":"https://api.github.com/repos/camallen/Panoptes/tags","blobs_url":"https://api.github.com/repos/camallen/Panoptes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/camallen/Panoptes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/camallen/Panoptes/git/refs{/sha}","trees_url":"https://api.github.com/repos/camallen/Panoptes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/camallen/Panoptes/statuses/{sha}","languages_url":"https://api.github.com/repos/camallen/Panoptes/languages","stargazers_url":"https://api.github.com/repos/camallen/Panoptes/stargazers","contributors_url":"https://api.github.com/repos/camallen/Panoptes/contributors","subscribers_url":"https://api.github.com/repos/camallen/Panoptes/subscribers","subscription_url":"https://api.github.com/repos/camallen/Panoptes/subscription","commits_url":"https://api.github.com/repos/camallen/Panoptes/commits{/sha}","git_commits_url":"https://api.github.com/repos/camallen/Panoptes/git/commits{/sha}","comments_url":"https://api.github.com/repos/camallen/Panoptes/comments{/number}","issue_comment_url":"https://api.github.com/repos/camallen/Panoptes/issues/comments{/number}","contents_url":"https://api.github.com/repos/camallen/Panoptes/contents/{+path}","compare_url":"https://api.github.com/repos/camallen/Panoptes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/camallen/Panoptes/merges","archive_url":"https://api.github.com/repos/camallen/Panoptes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/camallen/Panoptes/downloads","issues_url":"https://api.github.com/repos/camallen/Panoptes/issues{/number}","pulls_url":"https://api.github.com/repos/camallen/Panoptes/pulls{/number}","milestones_url":"https://api.github.com/repos/camallen/Panoptes/milestones{/number}","notifications_url":"https://api.github.com/repos/camallen/Panoptes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/camallen/Panoptes/labels{/name}","releases_url":"https://api.github.com/repos/camallen/Panoptes/releases{/id}","deployments_url":"https://api.github.com/repos/camallen/Panoptes/deployments","created_at":"2014-05-27T10:03:15Z","updated_at":"2016-03-02T10:46:36Z","pushed_at":"2018-06-26T13:47:19Z","git_url":"git://github.com/camallen/Panoptes.git","ssh_url":"git@github.com:camallen/Panoptes.git","clone_url":"https://github.com/camallen/Panoptes.git","svn_url":"https://github.com/camallen/Panoptes","homepage":"","size":7497,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"zooniverse:master","ref":"master","sha":"bb36cfbae8e8c109bcd8cf05ebdaffacf28605ae","user":{"login":"zooniverse","id":106856,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNjg1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/106856?v=4","gravatar_id":"","url":"https://api.github.com/users/zooniverse","html_url":"https://github.com/zooniverse","followers_url":"https://api.github.com/users/zooniverse/followers","following_url":"https://api.github.com/users/zooniverse/following{/other_user}","gists_url":"https://api.github.com/users/zooniverse/gists{/gist_id}","starred_url":"https://api.github.com/users/zooniverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zooniverse/subscriptions","organizations_url":"https://api.github.com/users/zooniverse/orgs","repos_url":"https://api.github.com/users/zooniverse/repos","events_url":"https://api.github.com/users/zooniverse/events{/privacy}","received_events_url":"https://api.github.com/users/zooniverse/received_events","type":"Organization","site_admin":false},"repo":{"id":19036577,"node_id":"MDEwOlJlcG9zaXRvcnkxOTAzNjU3Nw==","name":"Panoptes","full_name":"zooniverse/Panoptes","owner":{"login":"zooniverse","id":106856,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNjg1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/106856?v=4","gravatar_id":"","url":"https://api.github.com/users/zooniverse","html_url":"https://github.com/zooniverse","followers_url":"https://api.github.com/users/zooniverse/followers","following_url":"https://api.github.com/users/zooniverse/following{/other_user}","gists_url":"https://api.github.com/users/zooniverse/gists{/gist_id}","starred_url":"https://api.github.com/users/zooniverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zooniverse/subscriptions","organizations_url":"https://api.github.com/users/zooniverse/orgs","repos_url":"https://api.github.com/users/zooniverse/repos","events_url":"https://api.github.com/users/zooniverse/events{/privacy}","received_events_url":"https://api.github.com/users/zooniverse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zooniverse/Panoptes","description":"Zooniverse API to support user defined volunteer research projects","fork":false,"url":"https://api.github.com/repos/zooniverse/Panoptes","forks_url":"https://api.github.com/repos/zooniverse/Panoptes/forks","keys_url":"https://api.github.com/repos/zooniverse/Panoptes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zooniverse/Panoptes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zooniverse/Panoptes/teams","hooks_url":"https://api.github.com/repos/zooniverse/Panoptes/hooks","issue_events_url":"https://api.github.com/repos/zooniverse/Panoptes/issues/events{/number}","events_url":"https://api.github.com/repos/zooniverse/Panoptes/events","assignees_url":"https://api.github.com/repos/zooniverse/Panoptes/assignees{/user}","branches_url":"https://api.github.com/repos/zooniverse/Panoptes/branches{/branch}","tags_url":"https://api.github.com/repos/zooniverse/Panoptes/tags","blobs_url":"https://api.github.com/repos/zooniverse/Panoptes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zooniverse/Panoptes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zooniverse/Panoptes/git/refs{/sha}","trees_url":"https://api.github.com/repos/zooniverse/Panoptes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zooniverse/Panoptes/statuses/{sha}","languages_url":"https://api.github.com/repos/zooniverse/Panoptes/languages","stargazers_url":"https://api.github.com/repos/zooniverse/Panoptes/stargazers","contributors_url":"https://api.github.com/repos/zooniverse/Panoptes/contributors","subscribers_url":"https://api.github.com/repos/zooniverse/Panoptes/subscribers","subscription_url":"https://api.github.com/repos/zooniverse/Panoptes/subscription","commits_url":"https://api.github.com/repos/zooniverse/Panoptes/commits{/sha}","git_commits_url":"https://api.github.com/repos/zooniverse/Panoptes/git/commits{/sha}","comments_url":"https://api.github.com/repos/zooniverse/Panoptes/comments{/number}","issue_comment_url":"https://api.github.com/repos/zooniverse/Panoptes/issues/comments{/number}","contents_url":"https://api.github.com/repos/zooniverse/Panoptes/contents/{+path}","compare_url":"https://api.github.com/repos/zooniverse/Panoptes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zooniverse/Panoptes/merges","archive_url":"https://api.github.com/repos/zooniverse/Panoptes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zooniverse/Panoptes/downloads","issues_url":"https://api.github.com/repos/zooniverse/Panoptes/issues{/number}","pulls_url":"https://api.github.com/repos/zooniverse/Panoptes/pulls{/number}","milestones_url":"https://api.github.com/repos/zooniverse/Panoptes/milestones{/number}","notifications_url":"https://api.github.com/repos/zooniverse/Panoptes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zooniverse/Panoptes/labels{/name}","releases_url":"https://api.github.com/repos/zooniverse/Panoptes/releases{/id}","deployments_url":"https://api.github.com/repos/zooniverse/Panoptes/deployments","created_at":"2014-04-22T16:16:02Z","updated_at":"2018-06-26T07:09:09Z","pushed_at":"2018-06-26T14:42:53Z","git_url":"git://github.com/zooniverse/Panoptes.git","ssh_url":"git@github.com:zooniverse/Panoptes.git","clone_url":"https://github.com/zooniverse/Panoptes.git","svn_url":"https://github.com/zooniverse/Panoptes","homepage":"","size":7413,"stargazers_count":66,"watchers_count":66,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"archived":false,"open_issues_count":86,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":28,"open_issues":86,"watchers":66,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zooniverse/Panoptes/pulls/2805"},"html":{"href":"https://github.com/zooniverse/Panoptes/pull/2805"},"issue":{"href":"https://api.github.com/repos/zooniverse/Panoptes/issues/2805"},"comments":{"href":"https://api.github.com/repos/zooniverse/Panoptes/issues/2805/comments"},"review_comments":{"href":"https://api.github.com/repos/zooniverse/Panoptes/pulls/2805/comments"},"review_comment":{"href":"https://api.github.com/repos/zooniverse/Panoptes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zooniverse/Panoptes/pulls/2805/commits"},"statuses":{"href":"https://api.github.com/repos/zooniverse/Panoptes/statuses/a87b063b46d055524f2094fa43773238c7df73ca"}},"author_association":"MEMBER","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"camallen","id":295329,"node_id":"MDQ6VXNlcjI5NTMyOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/295329?v=4","gravatar_id":"","url":"https://api.github.com/users/camallen","html_url":"https://github.com/camallen","followers_url":"https://api.github.com/users/camallen/followers","following_url":"https://api.github.com/users/camallen/following{/other_user}","gists_url":"https://api.github.com/users/camallen/gists{/gist_id}","starred_url":"https://api.github.com/users/camallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camallen/subscriptions","organizations_url":"https://api.github.com/users/camallen/orgs","repos_url":"https://api.github.com/users/camallen/repos","events_url":"https://api.github.com/users/camallen/events{/privacy}","received_events_url":"https://api.github.com/users/camallen/received_events","type":"User","site_admin":false},"comments":0,"review_comments":8,"maintainer_can_modify":false,"commits":36,"additions":446,"deletions":302,"changed_files":17}}
{"actor":{"display_login":"camallen"}}