{"action":"created","comment":{"url":"https://api.github.com/repos/oppia/oppia/pulls/comments/46231512","id":46231512,"diff_hunk":"@@ -76,16 +78,37 @@ def get(self, username):\n         user_settings = user_services.get_user_settings_from_username(username)\n         if not user_settings:\n             raise self.PageNotFoundException\n+        \n+        user_contributions = user_services.get_user_contributions(\n+            user_settings.user_id)\n \n         self.values.update({\n             'user_bio': user_settings.user_bio,\n             'first_contribution_datetime': (\n-                utils.get_time_in_millisecs(user_settings.first_contribution_datetime)\n+                utils.get_time_in_millisecs(\n+                    user_settings.first_contribution_datetime)\n                 if user_settings.first_contribution_datetime else None),\n             'profile_picture_data_url': user_settings.profile_picture_data_url,\n+            'created_explorations_count': len(\n+                user_contributions.created_explorations),\n+            'edited_explorations_count': len(\n+                user_contributions.edited_explorations)\n+\n         })\n         self.render_json(self.values)\n \n+    def get_public_contributions(list_explorations):\n+        \"\"\"Pass in created or edited explorations,\n+        returns collection with only public explorations in list. \n+        \"\"\"\n+        public_explorations = []\n+\n+        for exploration_id in list_explorations:\n+            if rights_manager.is_exploration_public(exploration):\n+                public_explorations.append(exploration_id)\n+\n+        return public_explorations","path":"core/controllers/profile.py","position":50,"original_position":50,"commit_id":"5039d5304a2f1cb9d9e39b956d30c0a3665460d8","original_commit_id":"5039d5304a2f1cb9d9e39b956d30c0a3665460d8","user":{"login":"seanlip","id":10575562,"avatar_url":"https://avatars.githubusercontent.com/u/10575562?v=3","gravatar_id":"","url":"https://api.github.com/users/seanlip","html_url":"https://github.com/seanlip","followers_url":"https://api.github.com/users/seanlip/followers","following_url":"https://api.github.com/users/seanlip/following{/other_user}","gists_url":"https://api.github.com/users/seanlip/gists{/gist_id}","starred_url":"https://api.github.com/users/seanlip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanlip/subscriptions","organizations_url":"https://api.github.com/users/seanlip/orgs","repos_url":"https://api.github.com/users/seanlip/repos","events_url":"https://api.github.com/users/seanlip/events{/privacy}","received_events_url":"https://api.github.com/users/seanlip/received_events","type":"User","site_admin":false},"body":"Here, you are returning a list of ids of public explorations to the frontend. Wouldn't the frontend also need additional data? (Though I think you can get that from the summaries.)","created_at":"2015-12-01T01:50:14Z","updated_at":"2015-12-01T01:50:14Z","html_url":"https://github.com/oppia/oppia/pull/1176#discussion_r46231512","pull_request_url":"https://api.github.com/repos/oppia/oppia/pulls/1176","_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments/46231512"},"html":{"href":"https://github.com/oppia/oppia/pull/1176#discussion_r46231512"},"pull_request":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1176"}}},"pull_request":{"url":"https://api.github.com/repos/oppia/oppia/pulls/1176","id":51953461,"html_url":"https://github.com/oppia/oppia/pull/1176","diff_url":"https://github.com/oppia/oppia/pull/1176.diff","patch_url":"https://github.com/oppia/oppia/pull/1176.patch","issue_url":"https://api.github.com/repos/oppia/oppia/issues/1176","number":1176,"state":"open","locked":false,"title":"Add backend functionality for computing the explorations created and edited by each user","user":{"login":"hernandz","id":11132318,"avatar_url":"https://avatars.githubusercontent.com/u/11132318?v=3","gravatar_id":"","url":"https://api.github.com/users/hernandz","html_url":"https://github.com/hernandz","followers_url":"https://api.github.com/users/hernandz/followers","following_url":"https://api.github.com/users/hernandz/following{/other_user}","gists_url":"https://api.github.com/users/hernandz/gists{/gist_id}","starred_url":"https://api.github.com/users/hernandz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hernandz/subscriptions","organizations_url":"https://api.github.com/users/hernandz/orgs","repos_url":"https://api.github.com/users/hernandz/repos","events_url":"https://api.github.com/users/hernandz/events{/privacy}","received_events_url":"https://api.github.com/users/hernandz/received_events","type":"User","site_admin":false},"body":"Adds UserContributionsModel, associated domain object/functions, and calls up to front-end for use. Also adds function to profile handler to filter out non-public explorations for displaying to world.","created_at":"2015-11-27T01:36:49Z","updated_at":"2015-12-01T01:50:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8a3d706f92b834e6d31156432d5848745b732bd","assignee":{"login":"seanlip","id":10575562,"avatar_url":"https://avatars.githubusercontent.com/u/10575562?v=3","gravatar_id":"","url":"https://api.github.com/users/seanlip","html_url":"https://github.com/seanlip","followers_url":"https://api.github.com/users/seanlip/followers","following_url":"https://api.github.com/users/seanlip/following{/other_user}","gists_url":"https://api.github.com/users/seanlip/gists{/gist_id}","starred_url":"https://api.github.com/users/seanlip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanlip/subscriptions","organizations_url":"https://api.github.com/users/seanlip/orgs","repos_url":"https://api.github.com/users/seanlip/repos","events_url":"https://api.github.com/users/seanlip/events{/privacy}","received_events_url":"https://api.github.com/users/seanlip/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/oppia/oppia/pulls/1176/commits","review_comments_url":"https://api.github.com/repos/oppia/oppia/pulls/1176/comments","review_comment_url":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/oppia/oppia/issues/1176/comments","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/5039d5304a2f1cb9d9e39b956d30c0a3665460d8","head":{"label":"hernandz:usercontributions","ref":"usercontributions","sha":"5039d5304a2f1cb9d9e39b956d30c0a3665460d8","user":{"login":"hernandz","id":11132318,"avatar_url":"https://avatars.githubusercontent.com/u/11132318?v=3","gravatar_id":"","url":"https://api.github.com/users/hernandz","html_url":"https://github.com/hernandz","followers_url":"https://api.github.com/users/hernandz/followers","following_url":"https://api.github.com/users/hernandz/following{/other_user}","gists_url":"https://api.github.com/users/hernandz/gists{/gist_id}","starred_url":"https://api.github.com/users/hernandz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hernandz/subscriptions","organizations_url":"https://api.github.com/users/hernandz/orgs","repos_url":"https://api.github.com/users/hernandz/repos","events_url":"https://api.github.com/users/hernandz/events{/privacy}","received_events_url":"https://api.github.com/users/hernandz/received_events","type":"User","site_admin":false},"repo":{"id":45274634,"name":"oppia","full_name":"hernandz/oppia","owner":{"login":"hernandz","id":11132318,"avatar_url":"https://avatars.githubusercontent.com/u/11132318?v=3","gravatar_id":"","url":"https://api.github.com/users/hernandz","html_url":"https://github.com/hernandz","followers_url":"https://api.github.com/users/hernandz/followers","following_url":"https://api.github.com/users/hernandz/following{/other_user}","gists_url":"https://api.github.com/users/hernandz/gists{/gist_id}","starred_url":"https://api.github.com/users/hernandz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hernandz/subscriptions","organizations_url":"https://api.github.com/users/hernandz/orgs","repos_url":"https://api.github.com/users/hernandz/repos","events_url":"https://api.github.com/users/hernandz/events{/privacy}","received_events_url":"https://api.github.com/users/hernandz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hernandz/oppia","description":"Tool for collaboratively building interactive tutors.","fork":true,"url":"https://api.github.com/repos/hernandz/oppia","forks_url":"https://api.github.com/repos/hernandz/oppia/forks","keys_url":"https://api.github.com/repos/hernandz/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hernandz/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hernandz/oppia/teams","hooks_url":"https://api.github.com/repos/hernandz/oppia/hooks","issue_events_url":"https://api.github.com/repos/hernandz/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/hernandz/oppia/events","assignees_url":"https://api.github.com/repos/hernandz/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/hernandz/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/hernandz/oppia/tags","blobs_url":"https://api.github.com/repos/hernandz/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hernandz/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hernandz/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/hernandz/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hernandz/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/hernandz/oppia/languages","stargazers_url":"https://api.github.com/repos/hernandz/oppia/stargazers","contributors_url":"https://api.github.com/repos/hernandz/oppia/contributors","subscribers_url":"https://api.github.com/repos/hernandz/oppia/subscribers","subscription_url":"https://api.github.com/repos/hernandz/oppia/subscription","commits_url":"https://api.github.com/repos/hernandz/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/hernandz/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/hernandz/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/hernandz/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/hernandz/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/hernandz/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hernandz/oppia/merges","archive_url":"https://api.github.com/repos/hernandz/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hernandz/oppia/downloads","issues_url":"https://api.github.com/repos/hernandz/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/hernandz/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/hernandz/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/hernandz/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hernandz/oppia/labels{/name}","releases_url":"https://api.github.com/repos/hernandz/oppia/releases{/id}","created_at":"2015-10-30T20:21:00Z","updated_at":"2015-10-30T20:21:05Z","pushed_at":"2015-11-30T11:44:03Z","git_url":"git://github.com/hernandz/oppia.git","ssh_url":"git@github.com:hernandz/oppia.git","clone_url":"https://github.com/hernandz/oppia.git","svn_url":"https://github.com/hernandz/oppia","homepage":"https://www.oppia.org","size":38407,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"oppia:develop","ref":"develop","sha":"8df2013b820b3f44706d7d83356a6b5bbc84a157","user":{"login":"oppia","id":11620230,"avatar_url":"https://avatars.githubusercontent.com/u/11620230?v=3","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"repo":{"id":40687563,"name":"oppia","full_name":"oppia/oppia","owner":{"login":"oppia","id":11620230,"avatar_url":"https://avatars.githubusercontent.com/u/11620230?v=3","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/oppia/oppia","description":"Tool for collaboratively building interactive tutors.","fork":false,"url":"https://api.github.com/repos/oppia/oppia","forks_url":"https://api.github.com/repos/oppia/oppia/forks","keys_url":"https://api.github.com/repos/oppia/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oppia/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oppia/oppia/teams","hooks_url":"https://api.github.com/repos/oppia/oppia/hooks","issue_events_url":"https://api.github.com/repos/oppia/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/oppia/oppia/events","assignees_url":"https://api.github.com/repos/oppia/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/oppia/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/oppia/oppia/tags","blobs_url":"https://api.github.com/repos/oppia/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oppia/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oppia/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/oppia/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/oppia/oppia/languages","stargazers_url":"https://api.github.com/repos/oppia/oppia/stargazers","contributors_url":"https://api.github.com/repos/oppia/oppia/contributors","subscribers_url":"https://api.github.com/repos/oppia/oppia/subscribers","subscription_url":"https://api.github.com/repos/oppia/oppia/subscription","commits_url":"https://api.github.com/repos/oppia/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/oppia/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/oppia/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/oppia/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/oppia/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/oppia/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oppia/oppia/merges","archive_url":"https://api.github.com/repos/oppia/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oppia/oppia/downloads","issues_url":"https://api.github.com/repos/oppia/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/oppia/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/oppia/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/oppia/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oppia/oppia/labels{/name}","releases_url":"https://api.github.com/repos/oppia/oppia/releases{/id}","created_at":"2015-08-14T00:16:14Z","updated_at":"2015-11-30T22:24:46Z","pushed_at":"2015-12-01T01:36:39Z","git_url":"git://github.com/oppia/oppia.git","ssh_url":"git@github.com:oppia/oppia.git","clone_url":"https://github.com/oppia/oppia.git","svn_url":"https://github.com/oppia/oppia","homepage":"https://www.oppia.org","size":43858,"stargazers_count":60,"watchers_count":60,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":78,"mirror_url":null,"open_issues_count":235,"forks":78,"open_issues":235,"watchers":60,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1176"},"html":{"href":"https://github.com/oppia/oppia/pull/1176"},"issue":{"href":"https://api.github.com/repos/oppia/oppia/issues/1176"},"comments":{"href":"https://api.github.com/repos/oppia/oppia/issues/1176/comments"},"review_comments":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1176/comments"},"review_comment":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1176/commits"},"statuses":{"href":"https://api.github.com/repos/oppia/oppia/statuses/5039d5304a2f1cb9d9e39b956d30c0a3665460d8"}}}}