{"action":"created","comment":{"url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/comments/218482771","pull_request_review_id":156431217,"id":218482771,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODQ4Mjc3MQ==","diff_hunk":"@@ -253,6 +253,36 @@ def test_zero_possible(self):\n             },\n         )\n \n+    @XBlock.register_temp_plugin(StubCourse, 'course')\n+    def test_mean(self):\n+        course_key = CourseKey.from_string('course-v1:abc+def+ghi')\n+        data = [\n+            # earned, possible\n+            (5., 20.),\n+            (7., 14.),\n+            (3., 9.),\n+            (8., 14.),\n+        ]\n+        expected_mean = sum(item[0] / item[1] for item in data) / 5.\n+        completions = [\n+            models.Aggregator.objects.submit_completion(\n+                user=self.test_user,\n+                course_key=course_key,\n+                block_key=course_key.make_usage_key(block_type='course', block_id='course{}'.format(idx)),\n+                aggregation_name='course',\n+                earned=data[idx][0],\n+                possible=data[idx][1],\n+                last_modified=timezone.now(),\n+            )[0]\n+            for idx in range(4)\n+        ]","path":"tests/test_serializers.py","position":26,"original_position":26,"commit_id":"70e1e13f8a14497875a199a45712993da402c9d4","original_commit_id":"70e1e13f8a14497875a199a45712993da402c9d4","user":{"login":"xitij2000","id":118837,"node_id":"MDQ6VXNlcjExODgzNw==","avatar_url":"https://avatars2.githubusercontent.com/u/118837?v=4","gravatar_id":"","url":"https://api.github.com/users/xitij2000","html_url":"https://github.com/xitij2000","followers_url":"https://api.github.com/users/xitij2000/followers","following_url":"https://api.github.com/users/xitij2000/following{/other_user}","gists_url":"https://api.github.com/users/xitij2000/gists{/gist_id}","starred_url":"https://api.github.com/users/xitij2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitij2000/subscriptions","organizations_url":"https://api.github.com/users/xitij2000/orgs","repos_url":"https://api.github.com/users/xitij2000/repos","events_url":"https://api.github.com/users/xitij2000/events{/privacy}","received_events_url":"https://api.github.com/users/xitij2000/received_events","type":"User","site_admin":false},"body":"@jcdyer  I need a number to give each block a different id, hence this approach idx. ","created_at":"2018-09-18T15:32:58Z","updated_at":"2018-09-18T15:32:58Z","html_url":"https://github.com/open-craft/openedx-completion-aggregator/pull/24#discussion_r218482771","pull_request_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/24","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/comments/218482771"},"html":{"href":"https://github.com/open-craft/openedx-completion-aggregator/pull/24#discussion_r218482771"},"pull_request":{"href":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/24"}},"in_reply_to_id":218475382},"pull_request":{"url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/24","id":215561788,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1NTYxNzg4","html_url":"https://github.com/open-craft/openedx-completion-aggregator/pull/24","diff_url":"https://github.com/open-craft/openedx-completion-aggregator/pull/24.diff","patch_url":"https://github.com/open-craft/openedx-completion-aggregator/pull/24.patch","issue_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/issues/24","number":24,"state":"open","locked":false,"title":"[OC-5392] Add support for mean value in serializer","user":{"login":"xitij2000","id":118837,"node_id":"MDQ6VXNlcjExODgzNw==","avatar_url":"https://avatars2.githubusercontent.com/u/118837?v=4","gravatar_id":"","url":"https://api.github.com/users/xitij2000","html_url":"https://github.com/xitij2000","followers_url":"https://api.github.com/users/xitij2000/followers","following_url":"https://api.github.com/users/xitij2000/following{/other_user}","gists_url":"https://api.github.com/users/xitij2000/gists{/gist_id}","starred_url":"https://api.github.com/users/xitij2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitij2000/subscriptions","organizations_url":"https://api.github.com/users/xitij2000/orgs","repos_url":"https://api.github.com/users/xitij2000/repos","events_url":"https://api.github.com/users/xitij2000/events{/privacy}","received_events_url":"https://api.github.com/users/xitij2000/received_events","type":"User","site_admin":false},"body":"**Description:** \r\nFixes bug where mean value was expected by serializer but not present. Added basic support for mean values\r\n\r\n**JIRA:** OC-5392\r\n\r\n**Testing instructions:**\r\n\r\nCheck completions via /api/completion/v0/course/gnk/ckn/2018/?requested_fields=mean\r\nThere should not be a 500 error. \r\n\r\n**Reviewers:**\r\n- [ ] TBD\r\n\r\n**Merge checklist:**\r\n- [ ] All reviewers approved\r\n- [ ] CI build is green\r\n- [ ] Version bumped\r\n- [ ] Changelog record added\r\n- [ ] Documentation updated (not only docstrings)\r\n- [ ] Commits are squashed\r\n- [ ] PR author is listed in AUTHORS\r\n\r\n**Post merge:**\r\n- [ ] Create a tag\r\n- [ ] Check new version is pushed to PyPI after tag-triggered build is \r\n      finished.\r\n- [ ] Delete working branch (if not needed anymore)\r\n\r\n**Author concerns:** \r\nSupport for filtering users for mean calculations coming in future PR. \r\n","created_at":"2018-09-14T11:16:22Z","updated_at":"2018-09-18T15:32:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ad01096d5e1881da5085c96f41a6019066a21c0c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/24/commits","review_comments_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/24/comments","review_comment_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/issues/24/comments","statuses_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/statuses/70e1e13f8a14497875a199a45712993da402c9d4","head":{"label":"open-craft:kshitij/fix-means","ref":"kshitij/fix-means","sha":"70e1e13f8a14497875a199a45712993da402c9d4","user":{"login":"open-craft","id":7414786,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc0MTQ3ODY=","avatar_url":"https://avatars0.githubusercontent.com/u/7414786?v=4","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"repo":{"id":116283379,"node_id":"MDEwOlJlcG9zaXRvcnkxMTYyODMzNzk=","name":"openedx-completion-aggregator","full_name":"open-craft/openedx-completion-aggregator","private":false,"owner":{"login":"open-craft","id":7414786,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc0MTQ3ODY=","avatar_url":"https://avatars0.githubusercontent.com/u/7414786?v=4","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/open-craft/openedx-completion-aggregator","description":"An Open edX Django app that aggregates block-level completion data to report on different block types.","fork":false,"url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator","forks_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/forks","keys_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/teams","hooks_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/hooks","issue_events_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/issues/events{/number}","events_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/events","assignees_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/assignees{/user}","branches_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/branches{/branch}","tags_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/tags","blobs_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/statuses/{sha}","languages_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/languages","stargazers_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/stargazers","contributors_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/contributors","subscribers_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/subscribers","subscription_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/subscription","commits_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/contents/{+path}","compare_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/merges","archive_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/downloads","issues_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/issues{/number}","pulls_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls{/number}","milestones_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/milestones{/number}","notifications_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/labels{/name}","releases_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/releases{/id}","deployments_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/deployments","created_at":"2018-01-04T16:38:20Z","updated_at":"2018-09-18T06:39:58Z","pushed_at":"2018-09-18T13:53:30Z","git_url":"git://github.com/open-craft/openedx-completion-aggregator.git","ssh_url":"git@github.com:open-craft/openedx-completion-aggregator.git","clone_url":"https://github.com/open-craft/openedx-completion-aggregator.git","svn_url":"https://github.com/open-craft/openedx-completion-aggregator","homepage":null,"size":201,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"open-craft:master","ref":"master","sha":"75eafb84ca912038f70b753aa9e87947c87b3d83","user":{"login":"open-craft","id":7414786,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc0MTQ3ODY=","avatar_url":"https://avatars0.githubusercontent.com/u/7414786?v=4","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"repo":{"id":116283379,"node_id":"MDEwOlJlcG9zaXRvcnkxMTYyODMzNzk=","name":"openedx-completion-aggregator","full_name":"open-craft/openedx-completion-aggregator","private":false,"owner":{"login":"open-craft","id":7414786,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc0MTQ3ODY=","avatar_url":"https://avatars0.githubusercontent.com/u/7414786?v=4","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/open-craft/openedx-completion-aggregator","description":"An Open edX Django app that aggregates block-level completion data to report on different block types.","fork":false,"url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator","forks_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/forks","keys_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/teams","hooks_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/hooks","issue_events_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/issues/events{/number}","events_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/events","assignees_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/assignees{/user}","branches_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/branches{/branch}","tags_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/tags","blobs_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/statuses/{sha}","languages_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/languages","stargazers_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/stargazers","contributors_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/contributors","subscribers_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/subscribers","subscription_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/subscription","commits_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/contents/{+path}","compare_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/merges","archive_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/downloads","issues_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/issues{/number}","pulls_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls{/number}","milestones_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/milestones{/number}","notifications_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/labels{/name}","releases_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/releases{/id}","deployments_url":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/deployments","created_at":"2018-01-04T16:38:20Z","updated_at":"2018-09-18T06:39:58Z","pushed_at":"2018-09-18T13:53:30Z","git_url":"git://github.com/open-craft/openedx-completion-aggregator.git","ssh_url":"git@github.com:open-craft/openedx-completion-aggregator.git","clone_url":"https://github.com/open-craft/openedx-completion-aggregator.git","svn_url":"https://github.com/open-craft/openedx-completion-aggregator","homepage":null,"size":201,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/24"},"html":{"href":"https://github.com/open-craft/openedx-completion-aggregator/pull/24"},"issue":{"href":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/issues/24"},"comments":{"href":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/open-craft/openedx-completion-aggregator/statuses/70e1e13f8a14497875a199a45712993da402c9d4"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"xitij2000"}}