{"action":"created","comment":{"url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/comments/93032587","pull_request_review_id":13552689,"id":93032587,"diff_hunk":"@@ -147,15 +154,17 @@ def number_of_documents\n \n   def self.downloads_by_user(downloads:)\n     downloads.each_with_object({}) do |download, result|\n-      result[download.user_id_string] ||= 0\n-      result[download.user_id_string] += 1\n+      result[download.user_id] ||= {}\n+      result[download.user_id_string][:email] ||= download.email || User::NO_EMAIL","path":"app/models/download.rb","position":30,"original_position":30,"commit_id":"e6af69cdad8d063e79cd63e3c1ecc97851ca9a90","original_commit_id":"e6af69cdad8d063e79cd63e3c1ecc97851ca9a90","user":{"login":"aroltsch","id":3811786,"avatar_url":"https://avatars.githubusercontent.com/u/3811786?v=3","gravatar_id":"","url":"https://api.github.com/users/aroltsch","html_url":"https://github.com/aroltsch","followers_url":"https://api.github.com/users/aroltsch/followers","following_url":"https://api.github.com/users/aroltsch/following{/other_user}","gists_url":"https://api.github.com/users/aroltsch/gists{/gist_id}","starred_url":"https://api.github.com/users/aroltsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aroltsch/subscriptions","organizations_url":"https://api.github.com/users/aroltsch/orgs","repos_url":"https://api.github.com/users/aroltsch/repos","events_url":"https://api.github.com/users/aroltsch/events{/privacy}","received_events_url":"https://api.github.com/users/aroltsch/received_events","type":"User","site_admin":false},"body":"Yes. That's why I did what I did on line 138: search through ALL searches to find the email. This way we will call the query only once to find the email, instead of going through every download until we find the email. @shanear ","created_at":"2016-12-19T13:39:56Z","updated_at":"2016-12-19T13:39:56Z","html_url":"https://github.com/department-of-veterans-affairs/caseflow-efolder/pull/324#discussion_r93032587","pull_request_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/324","_links":{"self":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/comments/93032587"},"html":{"href":"https://github.com/department-of-veterans-affairs/caseflow-efolder/pull/324#discussion_r93032587"},"pull_request":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/324"}}},"pull_request":{"url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/324","id":98337452,"html_url":"https://github.com/department-of-veterans-affairs/caseflow-efolder/pull/324","diff_url":"https://github.com/department-of-veterans-affairs/caseflow-efolder/pull/324.diff","patch_url":"https://github.com/department-of-veterans-affairs/caseflow-efolder/pull/324.patch","issue_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/issues/324","number":324,"state":"open","locked":false,"title":"Add user's Email to the `searches` table","user":{"login":"aroltsch","id":3811786,"avatar_url":"https://avatars.githubusercontent.com/u/3811786?v=3","gravatar_id":"","url":"https://api.github.com/users/aroltsch","html_url":"https://github.com/aroltsch","followers_url":"https://api.github.com/users/aroltsch/followers","following_url":"https://api.github.com/users/aroltsch/following{/other_user}","gists_url":"https://api.github.com/users/aroltsch/gists{/gist_id}","starred_url":"https://api.github.com/users/aroltsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aroltsch/subscriptions","organizations_url":"https://api.github.com/users/aroltsch/orgs","repos_url":"https://api.github.com/users/aroltsch/repos","events_url":"https://api.github.com/users/aroltsch/events{/privacy}","received_events_url":"https://api.github.com/users/aroltsch/received_events","type":"User","site_admin":false},"body":"1. Add email to the `searches` table\r\n2. Add `database_cleaner` to rspec\r\n\r\n\r\nNote: I think it would be better to create a follow up issue and create a `users` table. ","created_at":"2016-12-16T13:48:46Z","updated_at":"2016-12-19T13:39:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d69b82a7ce5cb55fc6232cd57198c15db6d50911","assignee":{"login":"shanear","id":1596259,"avatar_url":"https://avatars.githubusercontent.com/u/1596259?v=3","gravatar_id":"","url":"https://api.github.com/users/shanear","html_url":"https://github.com/shanear","followers_url":"https://api.github.com/users/shanear/followers","following_url":"https://api.github.com/users/shanear/following{/other_user}","gists_url":"https://api.github.com/users/shanear/gists{/gist_id}","starred_url":"https://api.github.com/users/shanear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shanear/subscriptions","organizations_url":"https://api.github.com/users/shanear/orgs","repos_url":"https://api.github.com/users/shanear/repos","events_url":"https://api.github.com/users/shanear/events{/privacy}","received_events_url":"https://api.github.com/users/shanear/received_events","type":"User","site_admin":false},"assignees":[{"login":"shanear","id":1596259,"avatar_url":"https://avatars.githubusercontent.com/u/1596259?v=3","gravatar_id":"","url":"https://api.github.com/users/shanear","html_url":"https://github.com/shanear","followers_url":"https://api.github.com/users/shanear/followers","following_url":"https://api.github.com/users/shanear/following{/other_user}","gists_url":"https://api.github.com/users/shanear/gists{/gist_id}","starred_url":"https://api.github.com/users/shanear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shanear/subscriptions","organizations_url":"https://api.github.com/users/shanear/orgs","repos_url":"https://api.github.com/users/shanear/repos","events_url":"https://api.github.com/users/shanear/events{/privacy}","received_events_url":"https://api.github.com/users/shanear/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/324/commits","review_comments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/324/comments","review_comment_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/issues/324/comments","statuses_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/statuses/e6af69cdad8d063e79cd63e3c1ecc97851ca9a90","head":{"label":"department-of-veterans-affairs:anyar/301_add_users_email","ref":"anyar/301_add_users_email","sha":"e6af69cdad8d063e79cd63e3c1ecc97851ca9a90","user":{"login":"department-of-veterans-affairs","id":5421563,"avatar_url":"https://avatars.githubusercontent.com/u/5421563?v=3","gravatar_id":"","url":"https://api.github.com/users/department-of-veterans-affairs","html_url":"https://github.com/department-of-veterans-affairs","followers_url":"https://api.github.com/users/department-of-veterans-affairs/followers","following_url":"https://api.github.com/users/department-of-veterans-affairs/following{/other_user}","gists_url":"https://api.github.com/users/department-of-veterans-affairs/gists{/gist_id}","starred_url":"https://api.github.com/users/department-of-veterans-affairs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/department-of-veterans-affairs/subscriptions","organizations_url":"https://api.github.com/users/department-of-veterans-affairs/orgs","repos_url":"https://api.github.com/users/department-of-veterans-affairs/repos","events_url":"https://api.github.com/users/department-of-veterans-affairs/events{/privacy}","received_events_url":"https://api.github.com/users/department-of-veterans-affairs/received_events","type":"Organization","site_admin":false},"repo":{"id":50130088,"name":"caseflow-efolder","full_name":"department-of-veterans-affairs/caseflow-efolder","owner":{"login":"department-of-veterans-affairs","id":5421563,"avatar_url":"https://avatars.githubusercontent.com/u/5421563?v=3","gravatar_id":"","url":"https://api.github.com/users/department-of-veterans-affairs","html_url":"https://github.com/department-of-veterans-affairs","followers_url":"https://api.github.com/users/department-of-veterans-affairs/followers","following_url":"https://api.github.com/users/department-of-veterans-affairs/following{/other_user}","gists_url":"https://api.github.com/users/department-of-veterans-affairs/gists{/gist_id}","starred_url":"https://api.github.com/users/department-of-veterans-affairs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/department-of-veterans-affairs/subscriptions","organizations_url":"https://api.github.com/users/department-of-veterans-affairs/orgs","repos_url":"https://api.github.com/users/department-of-veterans-affairs/repos","events_url":"https://api.github.com/users/department-of-veterans-affairs/events{/privacy}","received_events_url":"https://api.github.com/users/department-of-veterans-affairs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/department-of-veterans-affairs/caseflow-efolder","description":"Tool for bulk download of efolder claim files","fork":false,"url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder","forks_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/forks","keys_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/teams","hooks_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/hooks","issue_events_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/issues/events{/number}","events_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/events","assignees_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/assignees{/user}","branches_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/branches{/branch}","tags_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/tags","blobs_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/git/refs{/sha}","trees_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/statuses/{sha}","languages_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/languages","stargazers_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/stargazers","contributors_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/contributors","subscribers_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/subscribers","subscription_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/subscription","commits_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/commits{/sha}","git_commits_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/git/commits{/sha}","comments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/comments{/number}","issue_comment_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/issues/comments{/number}","contents_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/contents/{+path}","compare_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/merges","archive_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/downloads","issues_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/issues{/number}","pulls_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls{/number}","milestones_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/milestones{/number}","notifications_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/labels{/name}","releases_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/releases{/id}","deployments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/deployments","created_at":"2016-01-21T19:08:28Z","updated_at":"2016-12-15T21:12:21Z","pushed_at":"2016-12-16T16:16:25Z","git_url":"git://github.com/department-of-veterans-affairs/caseflow-efolder.git","ssh_url":"git@github.com:department-of-veterans-affairs/caseflow-efolder.git","clone_url":"https://github.com/department-of-veterans-affairs/caseflow-efolder.git","svn_url":"https://github.com/department-of-veterans-affairs/caseflow-efolder","homepage":null,"size":3892,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":27,"forks":2,"open_issues":27,"watchers":2,"default_branch":"master"}},"base":{"label":"department-of-veterans-affairs:master","ref":"master","sha":"6e2b12f223048244b0b8ff8ba78b9c2fd6e2e163","user":{"login":"department-of-veterans-affairs","id":5421563,"avatar_url":"https://avatars.githubusercontent.com/u/5421563?v=3","gravatar_id":"","url":"https://api.github.com/users/department-of-veterans-affairs","html_url":"https://github.com/department-of-veterans-affairs","followers_url":"https://api.github.com/users/department-of-veterans-affairs/followers","following_url":"https://api.github.com/users/department-of-veterans-affairs/following{/other_user}","gists_url":"https://api.github.com/users/department-of-veterans-affairs/gists{/gist_id}","starred_url":"https://api.github.com/users/department-of-veterans-affairs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/department-of-veterans-affairs/subscriptions","organizations_url":"https://api.github.com/users/department-of-veterans-affairs/orgs","repos_url":"https://api.github.com/users/department-of-veterans-affairs/repos","events_url":"https://api.github.com/users/department-of-veterans-affairs/events{/privacy}","received_events_url":"https://api.github.com/users/department-of-veterans-affairs/received_events","type":"Organization","site_admin":false},"repo":{"id":50130088,"name":"caseflow-efolder","full_name":"department-of-veterans-affairs/caseflow-efolder","owner":{"login":"department-of-veterans-affairs","id":5421563,"avatar_url":"https://avatars.githubusercontent.com/u/5421563?v=3","gravatar_id":"","url":"https://api.github.com/users/department-of-veterans-affairs","html_url":"https://github.com/department-of-veterans-affairs","followers_url":"https://api.github.com/users/department-of-veterans-affairs/followers","following_url":"https://api.github.com/users/department-of-veterans-affairs/following{/other_user}","gists_url":"https://api.github.com/users/department-of-veterans-affairs/gists{/gist_id}","starred_url":"https://api.github.com/users/department-of-veterans-affairs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/department-of-veterans-affairs/subscriptions","organizations_url":"https://api.github.com/users/department-of-veterans-affairs/orgs","repos_url":"https://api.github.com/users/department-of-veterans-affairs/repos","events_url":"https://api.github.com/users/department-of-veterans-affairs/events{/privacy}","received_events_url":"https://api.github.com/users/department-of-veterans-affairs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/department-of-veterans-affairs/caseflow-efolder","description":"Tool for bulk download of efolder claim files","fork":false,"url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder","forks_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/forks","keys_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/teams","hooks_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/hooks","issue_events_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/issues/events{/number}","events_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/events","assignees_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/assignees{/user}","branches_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/branches{/branch}","tags_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/tags","blobs_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/git/refs{/sha}","trees_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/statuses/{sha}","languages_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/languages","stargazers_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/stargazers","contributors_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/contributors","subscribers_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/subscribers","subscription_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/subscription","commits_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/commits{/sha}","git_commits_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/git/commits{/sha}","comments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/comments{/number}","issue_comment_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/issues/comments{/number}","contents_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/contents/{+path}","compare_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/merges","archive_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/downloads","issues_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/issues{/number}","pulls_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls{/number}","milestones_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/milestones{/number}","notifications_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/labels{/name}","releases_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/releases{/id}","deployments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/deployments","created_at":"2016-01-21T19:08:28Z","updated_at":"2016-12-15T21:12:21Z","pushed_at":"2016-12-16T16:16:25Z","git_url":"git://github.com/department-of-veterans-affairs/caseflow-efolder.git","ssh_url":"git@github.com:department-of-veterans-affairs/caseflow-efolder.git","clone_url":"https://github.com/department-of-veterans-affairs/caseflow-efolder.git","svn_url":"https://github.com/department-of-veterans-affairs/caseflow-efolder","homepage":null,"size":3892,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":27,"forks":2,"open_issues":27,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/324"},"html":{"href":"https://github.com/department-of-veterans-affairs/caseflow-efolder/pull/324"},"issue":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/issues/324"},"comments":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/issues/324/comments"},"review_comments":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/324/comments"},"review_comment":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/pulls/324/commits"},"statuses":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow-efolder/statuses/e6af69cdad8d063e79cd63e3c1ecc97851ca9a90"}}}}
{"actor":{"display_login":"aroltsch"}}