{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/155154339","pull_request_review_id":81417250,"id":155154339,"diff_hunk":"@@ -106,6 +106,86 @@ def submit_completion(self, user, course_key, block_key, completion):\n         return obj, isnew\n \n \n+class AggregateCompletionManager(models.Manager):\n+    \"\"\"\n+    Custom manager for AggregateCompletion model.\n+\n+    \"\"\"\n+\n+    def submit_completion(self, user, course_key, block_key, aggregation_name, earned, possible):\n+        \"\"\"\n+        Inserts and Updates the completion AggregateCompletion for the specified record.\n+\n+        Parameters:\n+            * user (django.contrib.auth.models.User): The user for whom the\n+              completion is being submitted.\n+            * course_key (opaque_keys.edx.keys.CourseKey): The course in\n+              which the submitted block is found.\n+            * block_key (opaque_keys.edx.keys.UsageKey): The block that has had\n+              its completion changed.\n+            * aggregation_name : The name of the aggregated blocks. This is set by the level that the aggregation\n+              is occuring. Possible values are \"course\", \"chapter\", \"sequential\", \"vertical\"\n+            * earned: The sum of the fractional completions of all descendant blocks\n+            * possible: The total sum of the possible completion values of all descendant\n+              blocks that are visible to the user. This will always be a positive integer.\n+\n+        Return Value:\n+            (BlockCompletion, bool): A tuple comprising the created or updated\n+            BlockCompletion object and a boolean value indicating whether the\n+            object was newly created by this call.\n+\n+        Raises:\n+\n+            ValueError:\n+                If the wrong type is passed for one of the parameters.\n+\n+            django.core.exceptions.ValidationError:","path":"lms/djangoapps/completion/models.py","position":37,"original_position":37,"commit_id":"01c3fe2c92d74a1b0e6e5bb6a235cda28f712212","original_commit_id":"01c3fe2c92d74a1b0e6e5bb6a235cda28f712212","user":{"login":"pomegranited","id":7556571,"avatar_url":"https://avatars3.githubusercontent.com/u/7556571?v=4","gravatar_id":"","url":"https://api.github.com/users/pomegranited","html_url":"https://github.com/pomegranited","followers_url":"https://api.github.com/users/pomegranited/followers","following_url":"https://api.github.com/users/pomegranited/following{/other_user}","gists_url":"https://api.github.com/users/pomegranited/gists{/gist_id}","starred_url":"https://api.github.com/users/pomegranited/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pomegranited/subscriptions","organizations_url":"https://api.github.com/users/pomegranited/orgs","repos_url":"https://api.github.com/users/pomegranited/repos","events_url":"https://api.github.com/users/pomegranited/events{/privacy}","received_events_url":"https://api.github.com/users/pomegranited/received_events","type":"User","site_admin":false},"body":"This error is no longer thrown?","created_at":"2017-12-06T06:19:44Z","updated_at":"2017-12-06T07:03:01Z","html_url":"https://github.com/edx/edx-platform/pull/16715#discussion_r155154339","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/16715","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/155154339"},"html":{"href":"https://github.com/edx/edx-platform/pull/16715#discussion_r155154339"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/16715"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/16715","id":155485721,"html_url":"https://github.com/edx/edx-platform/pull/16715","diff_url":"https://github.com/edx/edx-platform/pull/16715.diff","patch_url":"https://github.com/edx/edx-platform/pull/16715.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/16715","number":16715,"state":"open","locked":false,"title":"[MCKIN-5899] Create model to track aggregate completion","user":{"login":"macornwell","id":2694231,"avatar_url":"https://avatars3.githubusercontent.com/u/2694231?v=4","gravatar_id":"","url":"https://api.github.com/users/macornwell","html_url":"https://github.com/macornwell","followers_url":"https://api.github.com/users/macornwell/followers","following_url":"https://api.github.com/users/macornwell/following{/other_user}","gists_url":"https://api.github.com/users/macornwell/gists{/gist_id}","starred_url":"https://api.github.com/users/macornwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macornwell/subscriptions","organizations_url":"https://api.github.com/users/macornwell/orgs","repos_url":"https://api.github.com/users/macornwell/repos","events_url":"https://api.github.com/users/macornwell/events{/privacy}","received_events_url":"https://api.github.com/users/macornwell/received_events","type":"User","site_admin":false},"body":"Creates an Aggregate completion model for the completion API.\r\n\r\nThe AggregateCompletion model inherits from TimeStampedModel and has the following fields:\r\n```\r\nid = BigAutoField(primary_key=True)  # pylint: disable=invalid-name\r\nuser = models.ForeignKey(User)\r\ncourse_key = CourseKeyField(max_length=255)\r\naggregation_name = models.CharField(max_length=255)\r\nblock_key = UsageKeyField(max_length=255)\r\nearned = models.FloatField()\r\npossible = models.FloatField()\r\npercent = models.FloatField(validators=[validate_percent])\r\n```\r\n**JIRA tickets**: MCKIN-5899\r\n\r\n**Sandbox URL**:\r\n- LMS: https://pr16715.sandbox.opencraft.hosting\r\n- Studio: https://studio-pr16715.sandbox.opencraft.hosting\r\n\r\n**Merge deadline**: None\r\n\r\n**Testing instructions**:\r\n\r\n1. N/A\r\n\r\n\r\n**Reviewers**\r\n- [ ] @pomegranited \r\n- [ ] edX reviewer[s] TBD","created_at":"2017-11-30T00:00:51Z","updated_at":"2017-12-06T07:03:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"907bce6a0479638716db04b37f3ddde510b09ad3","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/16715/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/16715/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/16715/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/01c3fe2c92d74a1b0e6e5bb6a235cda28f712212","head":{"label":"open-craft:cornwell/create-model","ref":"cornwell/create-model","sha":"01c3fe2c92d74a1b0e6e5bb6a235cda28f712212","user":{"login":"open-craft","id":7414786,"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":19940883,"name":"edx-platform","full_name":"open-craft/edx-platform","owner":{"login":"open-craft","id":7414786,"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},"private":false,"html_url":"https://github.com/open-craft/edx-platform","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/open-craft/edx-platform","forks_url":"https://api.github.com/repos/open-craft/edx-platform/forks","keys_url":"https://api.github.com/repos/open-craft/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-craft/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-craft/edx-platform/teams","hooks_url":"https://api.github.com/repos/open-craft/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/open-craft/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/open-craft/edx-platform/events","assignees_url":"https://api.github.com/repos/open-craft/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/open-craft/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/open-craft/edx-platform/tags","blobs_url":"https://api.github.com/repos/open-craft/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-craft/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-craft/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-craft/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-craft/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/open-craft/edx-platform/languages","stargazers_url":"https://api.github.com/repos/open-craft/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/open-craft/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/open-craft/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/open-craft/edx-platform/subscription","commits_url":"https://api.github.com/repos/open-craft/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-craft/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-craft/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-craft/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-craft/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/open-craft/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-craft/edx-platform/merges","archive_url":"https://api.github.com/repos/open-craft/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-craft/edx-platform/downloads","issues_url":"https://api.github.com/repos/open-craft/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/open-craft/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/open-craft/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/open-craft/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-craft/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/open-craft/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/open-craft/edx-platform/deployments","created_at":"2014-05-19T12:28:25Z","updated_at":"2017-08-14T18:35:23Z","pushed_at":"2017-12-06T02:04:06Z","git_url":"git://github.com/open-craft/edx-platform.git","ssh_url":"git@github.com:open-craft/edx-platform.git","clone_url":"https://github.com/open-craft/edx-platform.git","svn_url":"https://github.com/open-craft/edx-platform","homepage":"http://code.edx.org/","size":865875,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":2,"open_issues":6,"watchers":3,"default_branch":"open-craft-notice"}},"base":{"label":"edx:master","ref":"master","sha":"7463356c7f792867852e409c452dcc951c3d4eb6","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"The Open edX platform, the software that powers edX!","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-platform/deployments","created_at":"2013-05-30T20:20:38Z","updated_at":"2017-12-05T12:27:50Z","pushed_at":"2017-12-06T03:17:09Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://open.edx.org/","size":863825,"stargazers_count":3426,"watchers_count":3426,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1943,"mirror_url":null,"archived":false,"open_issues_count":213,"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"},"forks":1943,"open_issues":213,"watchers":3426,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/16715"},"html":{"href":"https://github.com/edx/edx-platform/pull/16715"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/16715"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/16715/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/16715/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/16715/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/01c3fe2c92d74a1b0e6e5bb6a235cda28f712212"}},"author_association":"NONE"}}
{"actor":{"display_login":"pomegranited"}}