{"action":"closed","number":1723,"pull_request":{"url":"https://api.github.com/repos/studentinsights/studentinsights/pulls/1723","id":189959527,"html_url":"https://github.com/studentinsights/studentinsights/pull/1723","diff_url":"https://github.com/studentinsights/studentinsights/pull/1723.diff","patch_url":"https://github.com/studentinsights/studentinsights/pull/1723.patch","issue_url":"https://api.github.com/repos/studentinsights/studentinsights/issues/1723","number":1723,"state":"closed","locked":false,"title":"Classrooms: Performance optimization for class list validations","user":{"login":"kevinrobinson","id":1056957,"avatar_url":"https://avatars3.githubusercontent.com/u/1056957?v=4","gravatar_id":"","url":"https://api.github.com/users/kevinrobinson","html_url":"https://github.com/kevinrobinson","followers_url":"https://api.github.com/users/kevinrobinson/followers","following_url":"https://api.github.com/users/kevinrobinson/following{/other_user}","gists_url":"https://api.github.com/users/kevinrobinson/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinrobinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinrobinson/subscriptions","organizations_url":"https://api.github.com/users/kevinrobinson/orgs","repos_url":"https://api.github.com/users/kevinrobinson/repos","events_url":"https://api.github.com/users/kevinrobinson/events{/privacy}","received_events_url":"https://api.github.com/users/kevinrobinson/received_events","type":"User","site_admin":false},"body":"# Who is this PR for?\r\nK-5 teaching teams, part of https://github.com/studentinsights/studentinsights/issues/1696.\r\n\r\n# What problem does this PR fix?\r\nThe existing validation code is slow when there are many records (testing with ~10k total, ~5k in one `workspace_id`).\r\n\r\n# What does this PR do?\r\nThis refactors the validation to optimize it, using a single query doing a SQL `group by` instead of doing this in ActiveRecord style.  No spec changes, specs pass as they are.\r\n","created_at":"2018-05-23T12:35:40Z","updated_at":"2018-05-23T12:55:42Z","closed_at":"2018-05-23T12:55:42Z","merged_at":"2018-05-23T12:55:42Z","merge_commit_sha":"815b47e19667e276844b8034d01620796ab8d431","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/studentinsights/studentinsights/pulls/1723/commits","review_comments_url":"https://api.github.com/repos/studentinsights/studentinsights/pulls/1723/comments","review_comment_url":"https://api.github.com/repos/studentinsights/studentinsights/pulls/comments{/number}","comments_url":"https://api.github.com/repos/studentinsights/studentinsights/issues/1723/comments","statuses_url":"https://api.github.com/repos/studentinsights/studentinsights/statuses/2bd24ba32e3c95c967bf9041d73339007c90671d","head":{"label":"studentinsights:perf/class-list-validation","ref":"perf/class-list-validation","sha":"2bd24ba32e3c95c967bf9041d73339007c90671d","user":{"login":"studentinsights","id":17129837,"avatar_url":"https://avatars2.githubusercontent.com/u/17129837?v=4","gravatar_id":"","url":"https://api.github.com/users/studentinsights","html_url":"https://github.com/studentinsights","followers_url":"https://api.github.com/users/studentinsights/followers","following_url":"https://api.github.com/users/studentinsights/following{/other_user}","gists_url":"https://api.github.com/users/studentinsights/gists{/gist_id}","starred_url":"https://api.github.com/users/studentinsights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/studentinsights/subscriptions","organizations_url":"https://api.github.com/users/studentinsights/orgs","repos_url":"https://api.github.com/users/studentinsights/repos","events_url":"https://api.github.com/users/studentinsights/events{/privacy}","received_events_url":"https://api.github.com/users/studentinsights/received_events","type":"Organization","site_admin":false},"repo":{"id":51324046,"name":"studentinsights","full_name":"studentinsights/studentinsights","owner":{"login":"studentinsights","id":17129837,"avatar_url":"https://avatars2.githubusercontent.com/u/17129837?v=4","gravatar_id":"","url":"https://api.github.com/users/studentinsights","html_url":"https://github.com/studentinsights","followers_url":"https://api.github.com/users/studentinsights/followers","following_url":"https://api.github.com/users/studentinsights/following{/other_user}","gists_url":"https://api.github.com/users/studentinsights/gists{/gist_id}","starred_url":"https://api.github.com/users/studentinsights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/studentinsights/subscriptions","organizations_url":"https://api.github.com/users/studentinsights/orgs","repos_url":"https://api.github.com/users/studentinsights/repos","events_url":"https://api.github.com/users/studentinsights/events{/privacy}","received_events_url":"https://api.github.com/users/studentinsights/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/studentinsights/studentinsights","description":"Student Insights for Somerville and New Bedford educators","fork":false,"url":"https://api.github.com/repos/studentinsights/studentinsights","forks_url":"https://api.github.com/repos/studentinsights/studentinsights/forks","keys_url":"https://api.github.com/repos/studentinsights/studentinsights/keys{/key_id}","collaborators_url":"https://api.github.com/repos/studentinsights/studentinsights/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/studentinsights/studentinsights/teams","hooks_url":"https://api.github.com/repos/studentinsights/studentinsights/hooks","issue_events_url":"https://api.github.com/repos/studentinsights/studentinsights/issues/events{/number}","events_url":"https://api.github.com/repos/studentinsights/studentinsights/events","assignees_url":"https://api.github.com/repos/studentinsights/studentinsights/assignees{/user}","branches_url":"https://api.github.com/repos/studentinsights/studentinsights/branches{/branch}","tags_url":"https://api.github.com/repos/studentinsights/studentinsights/tags","blobs_url":"https://api.github.com/repos/studentinsights/studentinsights/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/studentinsights/studentinsights/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/studentinsights/studentinsights/git/refs{/sha}","trees_url":"https://api.github.com/repos/studentinsights/studentinsights/git/trees{/sha}","statuses_url":"https://api.github.com/repos/studentinsights/studentinsights/statuses/{sha}","languages_url":"https://api.github.com/repos/studentinsights/studentinsights/languages","stargazers_url":"https://api.github.com/repos/studentinsights/studentinsights/stargazers","contributors_url":"https://api.github.com/repos/studentinsights/studentinsights/contributors","subscribers_url":"https://api.github.com/repos/studentinsights/studentinsights/subscribers","subscription_url":"https://api.github.com/repos/studentinsights/studentinsights/subscription","commits_url":"https://api.github.com/repos/studentinsights/studentinsights/commits{/sha}","git_commits_url":"https://api.github.com/repos/studentinsights/studentinsights/git/commits{/sha}","comments_url":"https://api.github.com/repos/studentinsights/studentinsights/comments{/number}","issue_comment_url":"https://api.github.com/repos/studentinsights/studentinsights/issues/comments{/number}","contents_url":"https://api.github.com/repos/studentinsights/studentinsights/contents/{+path}","compare_url":"https://api.github.com/repos/studentinsights/studentinsights/compare/{base}...{head}","merges_url":"https://api.github.com/repos/studentinsights/studentinsights/merges","archive_url":"https://api.github.com/repos/studentinsights/studentinsights/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/studentinsights/studentinsights/downloads","issues_url":"https://api.github.com/repos/studentinsights/studentinsights/issues{/number}","pulls_url":"https://api.github.com/repos/studentinsights/studentinsights/pulls{/number}","milestones_url":"https://api.github.com/repos/studentinsights/studentinsights/milestones{/number}","notifications_url":"https://api.github.com/repos/studentinsights/studentinsights/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/studentinsights/studentinsights/labels{/name}","releases_url":"https://api.github.com/repos/studentinsights/studentinsights/releases{/id}","deployments_url":"https://api.github.com/repos/studentinsights/studentinsights/deployments","created_at":"2016-02-08T20:15:35Z","updated_at":"2018-05-23T03:27:11Z","pushed_at":"2018-05-23T12:55:42Z","git_url":"git://github.com/studentinsights/studentinsights.git","ssh_url":"git@github.com:studentinsights/studentinsights.git","clone_url":"https://github.com/studentinsights/studentinsights.git","svn_url":"https://github.com/studentinsights/studentinsights","homepage":"https://somerville-teacher-tool-demo.herokuapp.com/","size":17813,"stargazers_count":89,"watchers_count":89,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"archived":false,"open_issues_count":97,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":45,"open_issues":97,"watchers":89,"default_branch":"master"}},"base":{"label":"studentinsights:master","ref":"master","sha":"b8a5a5c128d44476cd9bd2b19993195c8fca35c7","user":{"login":"studentinsights","id":17129837,"avatar_url":"https://avatars2.githubusercontent.com/u/17129837?v=4","gravatar_id":"","url":"https://api.github.com/users/studentinsights","html_url":"https://github.com/studentinsights","followers_url":"https://api.github.com/users/studentinsights/followers","following_url":"https://api.github.com/users/studentinsights/following{/other_user}","gists_url":"https://api.github.com/users/studentinsights/gists{/gist_id}","starred_url":"https://api.github.com/users/studentinsights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/studentinsights/subscriptions","organizations_url":"https://api.github.com/users/studentinsights/orgs","repos_url":"https://api.github.com/users/studentinsights/repos","events_url":"https://api.github.com/users/studentinsights/events{/privacy}","received_events_url":"https://api.github.com/users/studentinsights/received_events","type":"Organization","site_admin":false},"repo":{"id":51324046,"name":"studentinsights","full_name":"studentinsights/studentinsights","owner":{"login":"studentinsights","id":17129837,"avatar_url":"https://avatars2.githubusercontent.com/u/17129837?v=4","gravatar_id":"","url":"https://api.github.com/users/studentinsights","html_url":"https://github.com/studentinsights","followers_url":"https://api.github.com/users/studentinsights/followers","following_url":"https://api.github.com/users/studentinsights/following{/other_user}","gists_url":"https://api.github.com/users/studentinsights/gists{/gist_id}","starred_url":"https://api.github.com/users/studentinsights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/studentinsights/subscriptions","organizations_url":"https://api.github.com/users/studentinsights/orgs","repos_url":"https://api.github.com/users/studentinsights/repos","events_url":"https://api.github.com/users/studentinsights/events{/privacy}","received_events_url":"https://api.github.com/users/studentinsights/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/studentinsights/studentinsights","description":"Student Insights for Somerville and New Bedford educators","fork":false,"url":"https://api.github.com/repos/studentinsights/studentinsights","forks_url":"https://api.github.com/repos/studentinsights/studentinsights/forks","keys_url":"https://api.github.com/repos/studentinsights/studentinsights/keys{/key_id}","collaborators_url":"https://api.github.com/repos/studentinsights/studentinsights/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/studentinsights/studentinsights/teams","hooks_url":"https://api.github.com/repos/studentinsights/studentinsights/hooks","issue_events_url":"https://api.github.com/repos/studentinsights/studentinsights/issues/events{/number}","events_url":"https://api.github.com/repos/studentinsights/studentinsights/events","assignees_url":"https://api.github.com/repos/studentinsights/studentinsights/assignees{/user}","branches_url":"https://api.github.com/repos/studentinsights/studentinsights/branches{/branch}","tags_url":"https://api.github.com/repos/studentinsights/studentinsights/tags","blobs_url":"https://api.github.com/repos/studentinsights/studentinsights/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/studentinsights/studentinsights/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/studentinsights/studentinsights/git/refs{/sha}","trees_url":"https://api.github.com/repos/studentinsights/studentinsights/git/trees{/sha}","statuses_url":"https://api.github.com/repos/studentinsights/studentinsights/statuses/{sha}","languages_url":"https://api.github.com/repos/studentinsights/studentinsights/languages","stargazers_url":"https://api.github.com/repos/studentinsights/studentinsights/stargazers","contributors_url":"https://api.github.com/repos/studentinsights/studentinsights/contributors","subscribers_url":"https://api.github.com/repos/studentinsights/studentinsights/subscribers","subscription_url":"https://api.github.com/repos/studentinsights/studentinsights/subscription","commits_url":"https://api.github.com/repos/studentinsights/studentinsights/commits{/sha}","git_commits_url":"https://api.github.com/repos/studentinsights/studentinsights/git/commits{/sha}","comments_url":"https://api.github.com/repos/studentinsights/studentinsights/comments{/number}","issue_comment_url":"https://api.github.com/repos/studentinsights/studentinsights/issues/comments{/number}","contents_url":"https://api.github.com/repos/studentinsights/studentinsights/contents/{+path}","compare_url":"https://api.github.com/repos/studentinsights/studentinsights/compare/{base}...{head}","merges_url":"https://api.github.com/repos/studentinsights/studentinsights/merges","archive_url":"https://api.github.com/repos/studentinsights/studentinsights/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/studentinsights/studentinsights/downloads","issues_url":"https://api.github.com/repos/studentinsights/studentinsights/issues{/number}","pulls_url":"https://api.github.com/repos/studentinsights/studentinsights/pulls{/number}","milestones_url":"https://api.github.com/repos/studentinsights/studentinsights/milestones{/number}","notifications_url":"https://api.github.com/repos/studentinsights/studentinsights/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/studentinsights/studentinsights/labels{/name}","releases_url":"https://api.github.com/repos/studentinsights/studentinsights/releases{/id}","deployments_url":"https://api.github.com/repos/studentinsights/studentinsights/deployments","created_at":"2016-02-08T20:15:35Z","updated_at":"2018-05-23T03:27:11Z","pushed_at":"2018-05-23T12:55:42Z","git_url":"git://github.com/studentinsights/studentinsights.git","ssh_url":"git@github.com:studentinsights/studentinsights.git","clone_url":"https://github.com/studentinsights/studentinsights.git","svn_url":"https://github.com/studentinsights/studentinsights","homepage":"https://somerville-teacher-tool-demo.herokuapp.com/","size":17813,"stargazers_count":89,"watchers_count":89,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"archived":false,"open_issues_count":97,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":45,"open_issues":97,"watchers":89,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/studentinsights/studentinsights/pulls/1723"},"html":{"href":"https://github.com/studentinsights/studentinsights/pull/1723"},"issue":{"href":"https://api.github.com/repos/studentinsights/studentinsights/issues/1723"},"comments":{"href":"https://api.github.com/repos/studentinsights/studentinsights/issues/1723/comments"},"review_comments":{"href":"https://api.github.com/repos/studentinsights/studentinsights/pulls/1723/comments"},"review_comment":{"href":"https://api.github.com/repos/studentinsights/studentinsights/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/studentinsights/studentinsights/pulls/1723/commits"},"statuses":{"href":"https://api.github.com/repos/studentinsights/studentinsights/statuses/2bd24ba32e3c95c967bf9041d73339007c90671d"}},"author_association":"CONTRIBUTOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"kevinrobinson","id":1056957,"avatar_url":"https://avatars3.githubusercontent.com/u/1056957?v=4","gravatar_id":"","url":"https://api.github.com/users/kevinrobinson","html_url":"https://github.com/kevinrobinson","followers_url":"https://api.github.com/users/kevinrobinson/followers","following_url":"https://api.github.com/users/kevinrobinson/following{/other_user}","gists_url":"https://api.github.com/users/kevinrobinson/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinrobinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinrobinson/subscriptions","organizations_url":"https://api.github.com/users/kevinrobinson/orgs","repos_url":"https://api.github.com/users/kevinrobinson/repos","events_url":"https://api.github.com/users/kevinrobinson/events{/privacy}","received_events_url":"https://api.github.com/users/kevinrobinson/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"maintainer_can_modify":false,"commits":2,"additions":43,"deletions":21,"changed_files":2}}
{"actor":{"display_login":"kevinrobinson"}}