{"action":"created","comment":{"url":"https://api.github.com/repos/oppia/oppia/pulls/comments/60693617","id":60693617,"diff_hunk":"@@ -414,6 +414,186 @@ def test_nonhuman_committers_not_counted(self):\n             feconf.MIGRATION_BOT_USERNAME, exploration_summary.contributor_ids)\n \n \n+class ExplorationContributorsSummaryOneOffJobTest(test_utils.GenericTestBase):\n+    ONE_OFF_JOB_MANAGERS_FOR_TESTS = [\n+        exp_jobs_one_off.ExplorationContributorsSummaryOneOffJob]\n+\n+    EXP_ID = 'exp_id'\n+\n+    USERNAME_A = 'usernamea'\n+    USERNAME_B = 'usernameb'\n+    EMAIL_A = 'emaila@example.com'\n+    EMAIL_B = 'emailb@example.com'\n+\n+    def setUp(self):\n+        super(ExplorationContributorsSummaryOneOffJobTest, self).setUp()\n+\n+    def test_contributors_for_valid_nonrevert_contribution(self):\n+        \"\"\"Test that if only non-revert commits are made by\n+        contributor then the contributions summary shows same\n+        exact number of commits for that contributor's ID\n+        \"\"\"\n+\n+        self.signup(self.EMAIL_B, self.USERNAME_B)\n+        user_a_id = self.get_user_id_from_email(self.EMAIL_B)\n+\n+        # Let USER A make three commits.\n+        exploration = self.save_new_valid_exploration(\n+            self.EXP_ID, user_a_id, title='Exploration Title')\n+\n+        exp_services.update_exploration(\n+            user_a_id, self.EXP_ID, [{\n+                'cmd': 'edit_exploration_property',\n+                'property_name': 'title',\n+                'new_value': 'New Exploration Title'\n+            }], 'Changed title.')\n+\n+        exp_services.update_exploration(\n+            user_a_id, self.EXP_ID, [{\n+                'cmd': 'edit_exploration_property',\n+                'property_name': 'objective',\n+                'new_value': 'New Objective'\n+            }], 'Changed Objective.')\n+\n+        # Run the job to compute contributors summary\n+        job_id = exp_jobs_one_off.ExplorationContributorsSummaryOneOffJob\\\n+            .create_new()\n+        exp_jobs_one_off.ExplorationContributorsSummaryOneOffJob.enqueue(job_id)\n+        self.process_and_flush_pending_tasks()\n+\n+        exploration_summary = exp_services.get_exploration_summary_by_id(\n+            exploration.id)\n+\n+        self.assertEqual(\n+            3, exploration_summary.contributors_summary[user_a_id])\n+\n+    def test_contributors_with_only_reverts_not_included(self):\n+        \"\"\"Test that if only reverts are made by contributor then the\n+        contributions summary shouldn’t contain that contributor’s ID\n+        \"\"\"\n+\n+        # Sign up two users.\n+        self.signup(self.EMAIL_A, self.USERNAME_A)\n+        user_a_id = self.get_user_id_from_email(self.EMAIL_A)\n+        self.signup(self.EMAIL_B, self.USERNAME_B)\n+        user_b_id = self.get_user_id_from_email(self.EMAIL_B)\n+\n+        # Let USER A make three commits.\n+        exploration = self.save_new_valid_exploration(\n+            self.EXP_ID, user_a_id, title='Exploration Title 1')\n+\n+        exp_services.update_exploration(\n+            user_a_id, self.EXP_ID, [{\n+                'cmd': 'edit_exploration_property',\n+                'property_name': 'title',\n+                'new_value': 'New Exploration Title'\n+            }], 'Changed title.')\n+        exp_services.update_exploration(\n+            user_a_id, self.EXP_ID, [{\n+                'cmd': 'edit_exploration_property',\n+                'property_name': 'objective',\n+                'new_value': 'New Objective'\n+            }], 'Changed Objective.')\n+\n+        # Let the second user revert version 3 to version 2\n+        exp_services.revert_exploration(user_b_id, self.EXP_ID, 3, 2)\n+\n+        # Run the job to compute the contributors summary.\n+        job_id = exp_jobs_one_off.ExplorationContributorsSummaryOneOffJob\\\n+            .create_new()\n+        exp_jobs_one_off.ExplorationContributorsSummaryOneOffJob.enqueue(job_id)\n+        self.process_and_flush_pending_tasks()\n+\n+        # Check that the contributors_summary contains only user_a_id &\n+        # not user_b_id\n+        exploration_summary = exp_services.get_exploration_summary_by_id(\n+            exploration.id)\n+        self.assertNotIn(user_b_id, exploration_summary.contributors_summary)\n+        self.assertIn(user_a_id, exploration_summary.contributors_summary)","path":"core/domain/exp_jobs_one_off_test.py","position":null,"original_position":99,"commit_id":"55cd02ba5c5a2f4a39ce074c2d48a4f8506a438d","original_commit_id":"4e427ff34ed916a6f7d83d82d89feaa875841919","user":{"login":"anmolshkl","id":6338799,"avatar_url":"https://avatars.githubusercontent.com/u/6338799?v=3","gravatar_id":"","url":"https://api.github.com/users/anmolshkl","html_url":"https://github.com/anmolshkl","followers_url":"https://api.github.com/users/anmolshkl/followers","following_url":"https://api.github.com/users/anmolshkl/following{/other_user}","gists_url":"https://api.github.com/users/anmolshkl/gists{/gist_id}","starred_url":"https://api.github.com/users/anmolshkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anmolshkl/subscriptions","organizations_url":"https://api.github.com/users/anmolshkl/orgs","repos_url":"https://api.github.com/users/anmolshkl/repos","events_url":"https://api.github.com/users/anmolshkl/events{/privacy}","received_events_url":"https://api.github.com/users/anmolshkl/received_events","type":"User","site_admin":false},"body":"Done!","created_at":"2016-04-22T05:49:43Z","updated_at":"2016-04-22T05:49:43Z","html_url":"https://github.com/oppia/oppia/pull/1741#discussion_r60693617","pull_request_url":"https://api.github.com/repos/oppia/oppia/pulls/1741","_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments/60693617"},"html":{"href":"https://github.com/oppia/oppia/pull/1741#discussion_r60693617"},"pull_request":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1741"}}},"pull_request":{"url":"https://api.github.com/repos/oppia/oppia/pulls/1741","id":66805872,"html_url":"https://github.com/oppia/oppia/pull/1741","diff_url":"https://github.com/oppia/oppia/pull/1741.diff","patch_url":"https://github.com/oppia/oppia/pull/1741.patch","issue_url":"https://api.github.com/repos/oppia/oppia/issues/1741","number":1741,"state":"open","locked":false,"title":"add one-off test case to compute exploration contributor's summary","user":{"login":"anmolshkl","id":6338799,"avatar_url":"https://avatars.githubusercontent.com/u/6338799?v=3","gravatar_id":"","url":"https://api.github.com/users/anmolshkl","html_url":"https://github.com/anmolshkl","followers_url":"https://api.github.com/users/anmolshkl/followers","following_url":"https://api.github.com/users/anmolshkl/following{/other_user}","gists_url":"https://api.github.com/users/anmolshkl/gists{/gist_id}","starred_url":"https://api.github.com/users/anmolshkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anmolshkl/subscriptions","organizations_url":"https://api.github.com/users/anmolshkl/orgs","repos_url":"https://api.github.com/users/anmolshkl/repos","events_url":"https://api.github.com/users/anmolshkl/events{/privacy}","received_events_url":"https://api.github.com/users/anmolshkl/received_events","type":"User","site_admin":false},"body":"Add one-off test case `ExplorationContributorsSummaryOneOffJobTest` to compute exploration contributor's summary in exp_jobs_one_off","created_at":"2016-04-18T06:50:24Z","updated_at":"2016-04-22T05:49:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33a9ea49b078d422c89550d1f9af627511944a94","assignee":{"login":"maitbayev","id":5602283,"avatar_url":"https://avatars.githubusercontent.com/u/5602283?v=3","gravatar_id":"","url":"https://api.github.com/users/maitbayev","html_url":"https://github.com/maitbayev","followers_url":"https://api.github.com/users/maitbayev/followers","following_url":"https://api.github.com/users/maitbayev/following{/other_user}","gists_url":"https://api.github.com/users/maitbayev/gists{/gist_id}","starred_url":"https://api.github.com/users/maitbayev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maitbayev/subscriptions","organizations_url":"https://api.github.com/users/maitbayev/orgs","repos_url":"https://api.github.com/users/maitbayev/repos","events_url":"https://api.github.com/users/maitbayev/events{/privacy}","received_events_url":"https://api.github.com/users/maitbayev/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/oppia/oppia/pulls/1741/commits","review_comments_url":"https://api.github.com/repos/oppia/oppia/pulls/1741/comments","review_comment_url":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/oppia/oppia/issues/1741/comments","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/55cd02ba5c5a2f4a39ce074c2d48a4f8506a438d","head":{"label":"anmolshkl:mapreduce-tests","ref":"mapreduce-tests","sha":"55cd02ba5c5a2f4a39ce074c2d48a4f8506a438d","user":{"login":"anmolshkl","id":6338799,"avatar_url":"https://avatars.githubusercontent.com/u/6338799?v=3","gravatar_id":"","url":"https://api.github.com/users/anmolshkl","html_url":"https://github.com/anmolshkl","followers_url":"https://api.github.com/users/anmolshkl/followers","following_url":"https://api.github.com/users/anmolshkl/following{/other_user}","gists_url":"https://api.github.com/users/anmolshkl/gists{/gist_id}","starred_url":"https://api.github.com/users/anmolshkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anmolshkl/subscriptions","organizations_url":"https://api.github.com/users/anmolshkl/orgs","repos_url":"https://api.github.com/users/anmolshkl/repos","events_url":"https://api.github.com/users/anmolshkl/events{/privacy}","received_events_url":"https://api.github.com/users/anmolshkl/received_events","type":"User","site_admin":false},"repo":{"id":54198892,"name":"oppia","full_name":"anmolshkl/oppia","owner":{"login":"anmolshkl","id":6338799,"avatar_url":"https://avatars.githubusercontent.com/u/6338799?v=3","gravatar_id":"","url":"https://api.github.com/users/anmolshkl","html_url":"https://github.com/anmolshkl","followers_url":"https://api.github.com/users/anmolshkl/followers","following_url":"https://api.github.com/users/anmolshkl/following{/other_user}","gists_url":"https://api.github.com/users/anmolshkl/gists{/gist_id}","starred_url":"https://api.github.com/users/anmolshkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anmolshkl/subscriptions","organizations_url":"https://api.github.com/users/anmolshkl/orgs","repos_url":"https://api.github.com/users/anmolshkl/repos","events_url":"https://api.github.com/users/anmolshkl/events{/privacy}","received_events_url":"https://api.github.com/users/anmolshkl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anmolshkl/oppia","description":"Tool for collaboratively building intelligent tutors.","fork":true,"url":"https://api.github.com/repos/anmolshkl/oppia","forks_url":"https://api.github.com/repos/anmolshkl/oppia/forks","keys_url":"https://api.github.com/repos/anmolshkl/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anmolshkl/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anmolshkl/oppia/teams","hooks_url":"https://api.github.com/repos/anmolshkl/oppia/hooks","issue_events_url":"https://api.github.com/repos/anmolshkl/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/anmolshkl/oppia/events","assignees_url":"https://api.github.com/repos/anmolshkl/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/anmolshkl/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/anmolshkl/oppia/tags","blobs_url":"https://api.github.com/repos/anmolshkl/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anmolshkl/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anmolshkl/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/anmolshkl/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anmolshkl/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/anmolshkl/oppia/languages","stargazers_url":"https://api.github.com/repos/anmolshkl/oppia/stargazers","contributors_url":"https://api.github.com/repos/anmolshkl/oppia/contributors","subscribers_url":"https://api.github.com/repos/anmolshkl/oppia/subscribers","subscription_url":"https://api.github.com/repos/anmolshkl/oppia/subscription","commits_url":"https://api.github.com/repos/anmolshkl/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/anmolshkl/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/anmolshkl/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/anmolshkl/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/anmolshkl/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/anmolshkl/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anmolshkl/oppia/merges","archive_url":"https://api.github.com/repos/anmolshkl/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anmolshkl/oppia/downloads","issues_url":"https://api.github.com/repos/anmolshkl/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/anmolshkl/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/anmolshkl/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/anmolshkl/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anmolshkl/oppia/labels{/name}","releases_url":"https://api.github.com/repos/anmolshkl/oppia/releases{/id}","deployments_url":"https://api.github.com/repos/anmolshkl/oppia/deployments","created_at":"2016-03-18T12:17:19Z","updated_at":"2016-03-18T12:17:22Z","pushed_at":"2016-04-22T04:56:50Z","git_url":"git://github.com/anmolshkl/oppia.git","ssh_url":"git@github.com:anmolshkl/oppia.git","clone_url":"https://github.com/anmolshkl/oppia.git","svn_url":"https://github.com/anmolshkl/oppia","homepage":"https://www.oppia.org","size":42866,"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":"faee4d8ad524104faa88d9fa182633d58df386e1","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 intelligent 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}","deployments_url":"https://api.github.com/repos/oppia/oppia/deployments","created_at":"2015-08-14T00:16:14Z","updated_at":"2016-04-14T13:44:45Z","pushed_at":"2016-04-22T04:56:51Z","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":75242,"stargazers_count":117,"watchers_count":117,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":186,"mirror_url":null,"open_issues_count":284,"forks":186,"open_issues":284,"watchers":117,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1741"},"html":{"href":"https://github.com/oppia/oppia/pull/1741"},"issue":{"href":"https://api.github.com/repos/oppia/oppia/issues/1741"},"comments":{"href":"https://api.github.com/repos/oppia/oppia/issues/1741/comments"},"review_comments":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1741/comments"},"review_comment":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1741/commits"},"statuses":{"href":"https://api.github.com/repos/oppia/oppia/statuses/55cd02ba5c5a2f4a39ce074c2d48a4f8506a438d"}}}}