{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/31597850","id":31597850,"diff_hunk":"@@ -65,28 +67,35 @@ class CreditProvider(TimeStampedModel):\n class CreditRequirement(TimeStampedModel):\n     \"\"\"This model represents a credit requirement.\n \n-    Each requirement is uniquely identified by a `namespace` and a `name`. CreditRequirements\n-    also include a `criteria` dictionary, the format of which varies by the type of requirement.\n-    The criteria dictionary provides additional information clients may need to determine\n-    whether a user has satisfied the requirement.\n+    Each requirement is uniquely identified by its 'namespace' and\n+    'location'.\n+    The 'location' field stores the location of XBlock as a requirement, which\n+    serves as the unique identifier for a credit course requirement.\n+    The 'name' field stores the display name of the requirement.\n+    The 'criteria' field dictionary provides additional information, clients\n+    may need to determine whether a user has satisfied the requirement.\n     \"\"\"\n \n     course = models.ForeignKey(CreditCourse, related_name=\"credit_requirements\")\n     namespace = models.CharField(max_length=255)\n     name = models.CharField(max_length=255)\n+    location = models.CharField(max_length=255)","path":"openedx/core/djangoapps/credit/models.py","position":48,"original_position":48,"commit_id":"c230ff07d9324aac424c3ff2b5537225740975e0","original_commit_id":"c230ff07d9324aac424c3ff2b5537225740975e0","user":{"login":"zubair-arbi","id":5072991,"avatar_url":"https://avatars.githubusercontent.com/u/5072991?v=3","gravatar_id":"","url":"https://api.github.com/users/zubair-arbi","html_url":"https://github.com/zubair-arbi","followers_url":"https://api.github.com/users/zubair-arbi/followers","following_url":"https://api.github.com/users/zubair-arbi/following{/other_user}","gists_url":"https://api.github.com/users/zubair-arbi/gists{/gist_id}","starred_url":"https://api.github.com/users/zubair-arbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zubair-arbi/subscriptions","organizations_url":"https://api.github.com/users/zubair-arbi/orgs","repos_url":"https://api.github.com/users/zubair-arbi/repos","events_url":"https://api.github.com/users/zubair-arbi/events{/privacy}","received_events_url":"https://api.github.com/users/zubair-arbi/received_events","type":"User","site_admin":false},"body":"@wedaly that makes sense. I will update PR accordingly.","created_at":"2015-06-03T06:57:43Z","updated_at":"2015-06-03T06:57:43Z","html_url":"https://github.com/edx/edx-platform/pull/8315#discussion_r31597850","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/8315","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/31597850"},"html":{"href":"https://github.com/edx/edx-platform/pull/8315#discussion_r31597850"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/8315"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/8315","id":36716116,"html_url":"https://github.com/edx/edx-platform/pull/8315","diff_url":"https://github.com/edx/edx-platform/pull/8315.diff","patch_url":"https://github.com/edx/edx-platform/pull/8315.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/8315","number":8315,"state":"open","locked":false,"title":"add 'location' field in 'CreditRequirement' model to save the locatio…","user":{"login":"zubair-arbi","id":5072991,"avatar_url":"https://avatars.githubusercontent.com/u/5072991?v=3","gravatar_id":"","url":"https://api.github.com/users/zubair-arbi","html_url":"https://github.com/zubair-arbi","followers_url":"https://api.github.com/users/zubair-arbi/followers","following_url":"https://api.github.com/users/zubair-arbi/following{/other_user}","gists_url":"https://api.github.com/users/zubair-arbi/gists{/gist_id}","starred_url":"https://api.github.com/users/zubair-arbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zubair-arbi/subscriptions","organizations_url":"https://api.github.com/users/zubair-arbi/orgs","repos_url":"https://api.github.com/users/zubair-arbi/repos","events_url":"https://api.github.com/users/zubair-arbi/events{/privacy}","received_events_url":"https://api.github.com/users/zubair-arbi/received_events","type":"User","site_admin":false},"body":"…n of xblocks\r\n\r\n@awais786 @aamir-khan @ahsan-ul-haq \r\n\r\n* Add `location` field in `CreditRequirement` model. This field will save location in case of `XBlock` e.g., `i4x://edX/DemoX/edx-reverification-block/assessment_uuid` for `edx-reverification-block` and unique name in case of non XBlock e.g., `grade` for minimum credit grade requirement . This `location` will be used as a unique identifier of a credit course requirement.\r\n* Use `location` field` for checking if a requirement is already present and just need to update in case of saving or updating requirements.\r\n* `name` field will now save the display name of credit requirement e.g., `Assessment 1` which is saved in `related_assessment` field of `edx-reverification-block` xblock and `Grade` for the minimum credit grade requirement.\r\n* Update tests accordingly\r\n\r\n_**Example to set credit requirements:**_\r\n```python\r\nset_credit_requirements(\r\n    \"course-v1-edX-DemoX-1T2015\",\r\n    [\r\n        {\r\n            \"namespace\": \"reverification\",\r\n            \"name\": \"Assessment 1\",\r\n            \"location\": \"i4x://edX/DemoX/edx-reverification-block/assessment_uuid\"\r\n            \"criteria\": {},\r\n        },\r\n        {\r\n            \"namespace\": \"proctored_exam\",\r\n            \"name\": \"Final Exam\",\r\n            \"location\": \"i4x://edX/DemoX/proctoring-block/final_uuid\"\r\n            \"criteria\": {},\r\n        },\r\n        {\r\n            \"namespace\": \"grade\",\r\n            \"name\": \"Grade\",\r\n            \"location\": \"grade\"\r\n            \"criteria\": {\"min_grade\": 0.8},\r\n        },\r\n    ]\r\n)\r\n```\r\n","created_at":"2015-06-02T10:55:06Z","updated_at":"2015-06-03T06:57:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76518c50b2a555f474dc9c92b2b6a1ff1d589c4e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/8315/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/8315/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/8315/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/c230ff07d9324aac424c3ff2b5537225740975e0","head":{"label":"edx:zub/story/credit-requirement-model-add-location-id-field","ref":"zub/story/credit-requirement-model-add-location-id-field","sha":"c230ff07d9324aac424c3ff2b5537225740975e0","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","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://avatars.githubusercontent.com/u/3179841?v=3","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":"Open edX, the edX platform that powers http://edx.org","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}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-06-02T16:03:12Z","pushed_at":"2015-06-03T04:00:52Z","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://openedx.org/","size":1968770,"stargazers_count":1955,"watchers_count":1955,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1123,"mirror_url":null,"open_issues_count":189,"forks":1123,"open_issues":189,"watchers":1955,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"e8022c74f2598df4d5a6b9b2038ac5c22d145c60","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","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://avatars.githubusercontent.com/u/3179841?v=3","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":"Open edX, the edX platform that powers http://edx.org","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}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-06-02T16:03:12Z","pushed_at":"2015-06-03T04:00:52Z","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://openedx.org/","size":1968770,"stargazers_count":1955,"watchers_count":1955,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1123,"mirror_url":null,"open_issues_count":189,"forks":1123,"open_issues":189,"watchers":1955,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/8315"},"html":{"href":"https://github.com/edx/edx-platform/pull/8315"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/8315"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/8315/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/8315/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/8315/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/c230ff07d9324aac424c3ff2b5537225740975e0"}}}}