{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/pontoon/pulls/comments/42479738","id":42479738,"diff_hunk":"@@ -138,19 +142,25 @@ def locale_project(request, locale, slug):\n     \"\"\"Locale-project overview.\"\"\"\n     l = get_object_or_404(Locale, code__iexact=locale)\n \n-    project = (\n-        get_object_or_404(\n-            Project.objects.prefetch_related('subpage_set'),\n-            disabled=False,\n-            slug=slug,\n-            pk__in=Resource.objects.values('project')\n-        )\n+    projects = Project.objects.prefetch_related('subpage_set').distinct()","path":"pontoon/base/views.py","position":37,"original_position":37,"commit_id":"971b7067af8eded2e3aed25ab5908be351876dcf","original_commit_id":"971b7067af8eded2e3aed25ab5908be351876dcf","user":{"login":"mathjazz","id":626716,"avatar_url":"https://avatars.githubusercontent.com/u/626716?v=3","gravatar_id":"","url":"https://api.github.com/users/mathjazz","html_url":"https://github.com/mathjazz","followers_url":"https://api.github.com/users/mathjazz/followers","following_url":"https://api.github.com/users/mathjazz/following{/other_user}","gists_url":"https://api.github.com/users/mathjazz/gists{/gist_id}","starred_url":"https://api.github.com/users/mathjazz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathjazz/subscriptions","organizations_url":"https://api.github.com/users/mathjazz/orgs","repos_url":"https://api.github.com/users/mathjazz/repos","events_url":"https://api.github.com/users/mathjazz/events{/privacy}","received_events_url":"https://api.github.com/users/mathjazz/received_events","type":"User","site_admin":false},"body":"Is that distinct() really necessary?","created_at":"2015-10-20T10:42:21Z","updated_at":"2015-10-20T10:42:21Z","html_url":"https://github.com/mozilla/pontoon/pull/217#discussion_r42479738","pull_request_url":"https://api.github.com/repos/mozilla/pontoon/pulls/217","_links":{"self":{"href":"https://api.github.com/repos/mozilla/pontoon/pulls/comments/42479738"},"html":{"href":"https://github.com/mozilla/pontoon/pull/217#discussion_r42479738"},"pull_request":{"href":"https://api.github.com/repos/mozilla/pontoon/pulls/217"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/pontoon/pulls/217","id":48126127,"html_url":"https://github.com/mozilla/pontoon/pull/217","diff_url":"https://github.com/mozilla/pontoon/pull/217.diff","patch_url":"https://github.com/mozilla/pontoon/pull/217.patch","issue_url":"https://api.github.com/repos/mozilla/pontoon/issues/217","number":217,"state":"open","locked":false,"title":"Bug 1214392: Denormalize latest activity.","user":{"login":"Osmose","id":193106,"avatar_url":"https://avatars.githubusercontent.com/u/193106?v=3","gravatar_id":"","url":"https://api.github.com/users/Osmose","html_url":"https://github.com/Osmose","followers_url":"https://api.github.com/users/Osmose/followers","following_url":"https://api.github.com/users/Osmose/following{/other_user}","gists_url":"https://api.github.com/users/Osmose/gists{/gist_id}","starred_url":"https://api.github.com/users/Osmose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Osmose/subscriptions","organizations_url":"https://api.github.com/users/Osmose/orgs","repos_url":"https://api.github.com/users/Osmose/repos","events_url":"https://api.github.com/users/Osmose/events{/privacy}","received_events_url":"https://api.github.com/users/Osmose/received_events","type":"User","site_admin":false},"body":"This relies on #216, will rebase after that gets merged. Pay attention to the last commit only.\r\n\r\nThis denormalizes the latest activity such that Project, Resource, Locale, and ProjectLocale (which was previously an implicit through model for Project.locales) all have a `latest_translation` field that gets updated when translations are saved. The listings that show the latest activity now efficiently pull the `latest_translation` field when trying to figure out which translation qualifies as the latest activity, as opposed to doing a bunch of queries to find the latest activity.\r\n\r\nLocally this led to a major drop in load time for the project, locale, and resource listings for me. It also reduced the number of database queries on each page by quite a bit.\r\n\r\n@mathjazz r?","created_at":"2015-10-19T21:04:06Z","updated_at":"2015-10-20T10:42:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"72e885148be4bc0ad64cd6e461155e45edcb5f33","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/pontoon/pulls/217/commits","review_comments_url":"https://api.github.com/repos/mozilla/pontoon/pulls/217/comments","review_comment_url":"https://api.github.com/repos/mozilla/pontoon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/pontoon/issues/217/comments","statuses_url":"https://api.github.com/repos/mozilla/pontoon/statuses/971b7067af8eded2e3aed25ab5908be351876dcf","head":{"label":"Osmose:speed-up-project-list","ref":"speed-up-project-list","sha":"971b7067af8eded2e3aed25ab5908be351876dcf","user":{"login":"Osmose","id":193106,"avatar_url":"https://avatars.githubusercontent.com/u/193106?v=3","gravatar_id":"","url":"https://api.github.com/users/Osmose","html_url":"https://github.com/Osmose","followers_url":"https://api.github.com/users/Osmose/followers","following_url":"https://api.github.com/users/Osmose/following{/other_user}","gists_url":"https://api.github.com/users/Osmose/gists{/gist_id}","starred_url":"https://api.github.com/users/Osmose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Osmose/subscriptions","organizations_url":"https://api.github.com/users/Osmose/orgs","repos_url":"https://api.github.com/users/Osmose/repos","events_url":"https://api.github.com/users/Osmose/events{/privacy}","received_events_url":"https://api.github.com/users/Osmose/received_events","type":"User","site_admin":false},"repo":{"id":35060964,"name":"pontoon","full_name":"Osmose/pontoon","owner":{"login":"Osmose","id":193106,"avatar_url":"https://avatars.githubusercontent.com/u/193106?v=3","gravatar_id":"","url":"https://api.github.com/users/Osmose","html_url":"https://github.com/Osmose","followers_url":"https://api.github.com/users/Osmose/followers","following_url":"https://api.github.com/users/Osmose/following{/other_user}","gists_url":"https://api.github.com/users/Osmose/gists{/gist_id}","starred_url":"https://api.github.com/users/Osmose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Osmose/subscriptions","organizations_url":"https://api.github.com/users/Osmose/orgs","repos_url":"https://api.github.com/users/Osmose/repos","events_url":"https://api.github.com/users/Osmose/events{/privacy}","received_events_url":"https://api.github.com/users/Osmose/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Osmose/pontoon","description":"In-place localization tool","fork":true,"url":"https://api.github.com/repos/Osmose/pontoon","forks_url":"https://api.github.com/repos/Osmose/pontoon/forks","keys_url":"https://api.github.com/repos/Osmose/pontoon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Osmose/pontoon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Osmose/pontoon/teams","hooks_url":"https://api.github.com/repos/Osmose/pontoon/hooks","issue_events_url":"https://api.github.com/repos/Osmose/pontoon/issues/events{/number}","events_url":"https://api.github.com/repos/Osmose/pontoon/events","assignees_url":"https://api.github.com/repos/Osmose/pontoon/assignees{/user}","branches_url":"https://api.github.com/repos/Osmose/pontoon/branches{/branch}","tags_url":"https://api.github.com/repos/Osmose/pontoon/tags","blobs_url":"https://api.github.com/repos/Osmose/pontoon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Osmose/pontoon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Osmose/pontoon/git/refs{/sha}","trees_url":"https://api.github.com/repos/Osmose/pontoon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Osmose/pontoon/statuses/{sha}","languages_url":"https://api.github.com/repos/Osmose/pontoon/languages","stargazers_url":"https://api.github.com/repos/Osmose/pontoon/stargazers","contributors_url":"https://api.github.com/repos/Osmose/pontoon/contributors","subscribers_url":"https://api.github.com/repos/Osmose/pontoon/subscribers","subscription_url":"https://api.github.com/repos/Osmose/pontoon/subscription","commits_url":"https://api.github.com/repos/Osmose/pontoon/commits{/sha}","git_commits_url":"https://api.github.com/repos/Osmose/pontoon/git/commits{/sha}","comments_url":"https://api.github.com/repos/Osmose/pontoon/comments{/number}","issue_comment_url":"https://api.github.com/repos/Osmose/pontoon/issues/comments{/number}","contents_url":"https://api.github.com/repos/Osmose/pontoon/contents/{+path}","compare_url":"https://api.github.com/repos/Osmose/pontoon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Osmose/pontoon/merges","archive_url":"https://api.github.com/repos/Osmose/pontoon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Osmose/pontoon/downloads","issues_url":"https://api.github.com/repos/Osmose/pontoon/issues{/number}","pulls_url":"https://api.github.com/repos/Osmose/pontoon/pulls{/number}","milestones_url":"https://api.github.com/repos/Osmose/pontoon/milestones{/number}","notifications_url":"https://api.github.com/repos/Osmose/pontoon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Osmose/pontoon/labels{/name}","releases_url":"https://api.github.com/repos/Osmose/pontoon/releases{/id}","created_at":"2015-05-04T21:33:45Z","updated_at":"2015-08-18T17:56:55Z","pushed_at":"2015-10-19T21:09:17Z","git_url":"git://github.com/Osmose/pontoon.git","ssh_url":"git@github.com:Osmose/pontoon.git","clone_url":"https://github.com/Osmose/pontoon.git","svn_url":"https://github.com/Osmose/pontoon","homepage":"https://pontoon.mozilla.org/","size":18791,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"12fbe65b0cfcf56d8079efe7acff1df56df84cfa","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":1385890,"name":"pontoon","full_name":"mozilla/pontoon","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/pontoon","description":"In-place localization tool","fork":false,"url":"https://api.github.com/repos/mozilla/pontoon","forks_url":"https://api.github.com/repos/mozilla/pontoon/forks","keys_url":"https://api.github.com/repos/mozilla/pontoon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/pontoon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/pontoon/teams","hooks_url":"https://api.github.com/repos/mozilla/pontoon/hooks","issue_events_url":"https://api.github.com/repos/mozilla/pontoon/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/pontoon/events","assignees_url":"https://api.github.com/repos/mozilla/pontoon/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/pontoon/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/pontoon/tags","blobs_url":"https://api.github.com/repos/mozilla/pontoon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/pontoon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/pontoon/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/pontoon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/pontoon/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/pontoon/languages","stargazers_url":"https://api.github.com/repos/mozilla/pontoon/stargazers","contributors_url":"https://api.github.com/repos/mozilla/pontoon/contributors","subscribers_url":"https://api.github.com/repos/mozilla/pontoon/subscribers","subscription_url":"https://api.github.com/repos/mozilla/pontoon/subscription","commits_url":"https://api.github.com/repos/mozilla/pontoon/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/pontoon/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/pontoon/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/pontoon/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/pontoon/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/pontoon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/pontoon/merges","archive_url":"https://api.github.com/repos/mozilla/pontoon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/pontoon/downloads","issues_url":"https://api.github.com/repos/mozilla/pontoon/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/pontoon/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/pontoon/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/pontoon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/pontoon/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/pontoon/releases{/id}","created_at":"2011-02-19T11:25:51Z","updated_at":"2015-10-19T17:45:00Z","pushed_at":"2015-10-20T08:19:04Z","git_url":"git://github.com/mozilla/pontoon.git","ssh_url":"git@github.com:mozilla/pontoon.git","clone_url":"https://github.com/mozilla/pontoon.git","svn_url":"https://github.com/mozilla/pontoon","homepage":"https://pontoon.mozilla.org/","size":23536,"stargazers_count":77,"watchers_count":77,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":5,"forks":29,"open_issues":5,"watchers":77,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/pontoon/pulls/217"},"html":{"href":"https://github.com/mozilla/pontoon/pull/217"},"issue":{"href":"https://api.github.com/repos/mozilla/pontoon/issues/217"},"comments":{"href":"https://api.github.com/repos/mozilla/pontoon/issues/217/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/pontoon/pulls/217/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/pontoon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/pontoon/pulls/217/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/pontoon/statuses/971b7067af8eded2e3aed25ab5908be351876dcf"}}}}