GitHub PullRequestReviewCommentEvent at 2014-08-20 21:57:23
Repository: edx-platform
Actor: mattdrayer
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/comments/16508628","id":16508628,"diff_hunk":"@@ -80,3 +48,72 @@ def get_course_total_score(course_summary):\n             if section['section_total']:\n                 score += section['section_total'][1]\n     return score\n+\n+\n+def get_course_key(course_id):\n+    try:\n+        course_key = CourseKey.from_string(course_id)\n+    except InvalidKeyError:\n+        try:\n+            course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n+        except InvalidKeyError:\n+            course_key = None\n+    return course_key\n+\n+\n+def get_course_descriptor(course_key, depth):\n+    try:\n+        course_descriptor = courses.get_course(course_key, depth)\n+    except ValueError:\n+        course_descriptor = None\n+    return course_descriptor\n+\n+\n+def get_course_content(request, user, course_key, course_descriptor):\n+    field_data_cache = FieldDataCache([course_descriptor], course_key, user)\n+    course_content = module_render.get_module_for_descriptor(\n+        user,\n+        request,\n+        course_descriptor,\n+        field_data_cache,\n+        course_key)\n+    return course_content\n+\n+\n+def course_exists(request, user, course_id):","path":"lms/djangoapps/api_manager/courseware_access.py","position":115,"original_position":115,"commit_id":"121c0e72957963e145eef4562a7fb09370d626d8","original_commit_id":"121c0e72957963e145eef4562a7fb09370d626d8","user":{"login":"mattdrayer","id":4520595,"avatar_url":"https://avatars.githubusercontent.com/u/4520595?v=2","gravatar_id":"66543fc44304d136faf82189ae39a43e","url":"https://api.github.com/users/mattdrayer","html_url":"https://github.com/mattdrayer","followers_url":"https://api.github.com/users/mattdrayer/followers","following_url":"https://api.github.com/users/mattdrayer/following{/other_user}","gists_url":"https://api.github.com/users/mattdrayer/gists{/gist_id}","starred_url":"https://api.github.com/users/mattdrayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattdrayer/subscriptions","organizations_url":"https://api.github.com/users/mattdrayer/orgs","repos_url":"https://api.github.com/users/mattdrayer/repos","events_url":"https://api.github.com/users/mattdrayer/events{/privacy}","received_events_url":"https://api.github.com/users/mattdrayer/received_events","type":"User","site_admin":false},"body":"I had it in there, but after reviewing the code there wasn't really a need\r\nfor it -- all of the places we would perform the existence check actually\r\nuse the data returned from get_child_course in the method.  We can add it\r\ndown the road if we find we are creating workflows which just need to\r\nperform a quick check.\r\n\r\n\r\nOn Wed, Aug 20, 2014 at 5:26 PM, chrisndodge <notifications@github.com>\r\nwrote:\r\n\r\n> In lms/djangoapps/api_manager/courseware_access.py:\r\n>\r\n> > +        course_descriptor = None\r\n> > +    return course_descriptor\r\n> > +\r\n> > +\r\n> > +def get_course_content(request, user, course_key, course_descriptor):\r\n> > +    field_data_cache = FieldDataCache([course_descriptor], course_key, user)\r\n> > +    course_content = module_render.get_module_for_descriptor(\r\n> > +        user,\r\n> > +        request,\r\n> > +        course_descriptor,\r\n> > +        field_data_cache,\r\n> > +        course_key)\r\n> > +    return course_content\r\n> > +\r\n> > +\r\n> > +def course_exists(request, user, course_id):\r\n>\r\n> Do we also want a corresponding 'item_exists' test? I believe there is a\r\n> 'has_item()' method in the modulestore.\r\n>\r\n> —\r\n> Reply to this email directly or view it on GitHub\r\n> <https://github.com/edx-solutions/edx-platform/pull/189/files#r16506790>.\r\n>\r\n\r\n\r\n\r\n-- \r\nMatthew Drayer\r\nSolutions Architect\r\nedX | MIT\r\nmattdrayer@edx.org","created_at":"2014-08-20T21:57:23Z","updated_at":"2014-08-20T21:57:23Z","html_url":"https://github.com/edx-solutions/edx-platform/pull/189#discussion_r16508628","pull_request_url":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/189","_links":{"self":{"href":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/comments/16508628"},"html":{"href":"https://github.com/edx-solutions/edx-platform/pull/189#discussion_r16508628"},"pull_request":{"href":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/189"}}},"pull_request":{"url":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/189","id":20074148,"html_url":"https://github.com/edx-solutions/edx-platform/pull/189","diff_url":"https://github.com/edx-solutions/edx-platform/pull/189.diff","patch_url":"https://github.com/edx-solutions/edx-platform/pull/189.patch","issue_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/189","number":189,"state":"open","locked":false,"title":"mattdrayer/api-course-exists-check: Refactored course lookup logic","user":{"login":"mattdrayer","id":4520595,"avatar_url":"https://avatars.githubusercontent.com/u/4520595?v=2","gravatar_id":"66543fc44304d136faf82189ae39a43e","url":"https://api.github.com/users/mattdrayer","html_url":"https://github.com/mattdrayer","followers_url":"https://api.github.com/users/mattdrayer/followers","following_url":"https://api.github.com/users/mattdrayer/following{/other_user}","gists_url":"https://api.github.com/users/mattdrayer/gists{/gist_id}","starred_url":"https://api.github.com/users/mattdrayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattdrayer/subscriptions","organizations_url":"https://api.github.com/users/mattdrayer/orgs","repos_url":"https://api.github.com/users/mattdrayer/repos","events_url":"https://api.github.com/users/mattdrayer/events{/privacy}","received_events_url":"https://api.github.com/users/mattdrayer/received_events","type":"User","site_admin":false},"body":"@chrisndodge @ziafazal -- made some changes to the course lookup logic -- added the discussed existence check and also tuned/simplified a lot of the view code.  Test suite appears to run 9-10 seconds faster now, so I'm hoping that is a good sign for real deployments.\r\n\r\nTake a look and let me know what you think.","created_at":"2014-08-20T21:08:56Z","updated_at":"2014-08-20T21:57:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"47a43b7357495443888adcaf8a77835f3401bbaa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/189/commits","review_comments_url":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/189/comments","review_comment_url":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/comments/{number}","comments_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/189/comments","statuses_url":"https://api.github.com/repos/edx-solutions/edx-platform/statuses/121c0e72957963e145eef4562a7fb09370d626d8","head":{"label":"edx-solutions:mattdrayer/api-course-exists-check","ref":"mattdrayer/api-course-exists-check","sha":"121c0e72957963e145eef4562a7fb09370d626d8","user":{"login":"edx-solutions","id":6585054,"avatar_url":"https://avatars.githubusercontent.com/u/6585054?v=2","gravatar_id":null,"url":"https://api.github.com/users/edx-solutions","html_url":"https://github.com/edx-solutions","followers_url":"https://api.github.com/users/edx-solutions/followers","following_url":"https://api.github.com/users/edx-solutions/following{/other_user}","gists_url":"https://api.github.com/users/edx-solutions/gists{/gist_id}","starred_url":"https://api.github.com/users/edx-solutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx-solutions/subscriptions","organizations_url":"https://api.github.com/users/edx-solutions/orgs","repos_url":"https://api.github.com/users/edx-solutions/repos","events_url":"https://api.github.com/users/edx-solutions/events{/privacy}","received_events_url":"https://api.github.com/users/edx-solutions/received_events","type":"Organization","site_admin":false},"repo":{"id":16513414,"name":"edx-platform","full_name":"edx-solutions/edx-platform","owner":{"login":"edx-solutions","id":6585054,"avatar_url":"https://avatars.githubusercontent.com/u/6585054?v=2","gravatar_id":null,"url":"https://api.github.com/users/edx-solutions","html_url":"https://github.com/edx-solutions","followers_url":"https://api.github.com/users/edx-solutions/followers","following_url":"https://api.github.com/users/edx-solutions/following{/other_user}","gists_url":"https://api.github.com/users/edx-solutions/gists{/gist_id}","starred_url":"https://api.github.com/users/edx-solutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx-solutions/subscriptions","organizations_url":"https://api.github.com/users/edx-solutions/orgs","repos_url":"https://api.github.com/users/edx-solutions/repos","events_url":"https://api.github.com/users/edx-solutions/events{/privacy}","received_events_url":"https://api.github.com/users/edx-solutions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx-solutions/edx-platform","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/edx-solutions/edx-platform","forks_url":"https://api.github.com/repos/edx-solutions/edx-platform/forks","keys_url":"https://api.github.com/repos/edx-solutions/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx-solutions/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx-solutions/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx-solutions/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx-solutions/edx-platform/events","assignees_url":"https://api.github.com/repos/edx-solutions/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx-solutions/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx-solutions/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx-solutions/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx-solutions/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx-solutions/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx-solutions/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx-solutions/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx-solutions/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx-solutions/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx-solutions/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx-solutions/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx-solutions/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx-solutions/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx-solutions/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx-solutions/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx-solutions/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx-solutions/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx-solutions/edx-platform/merges","archive_url":"https://api.github.com/repos/edx-solutions/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx-solutions/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx-solutions/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx-solutions/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx-solutions/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx-solutions/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx-solutions/edx-platform/releases{/id}","created_at":"2014-02-04T14:02:57Z","updated_at":"2014-08-11T19:43:41Z","pushed_at":"2014-08-20T21:07:12Z","git_url":"git://github.com/edx-solutions/edx-platform.git","ssh_url":"git@github.com:edx-solutions/edx-platform.git","clone_url":"https://github.com/edx-solutions/edx-platform.git","svn_url":"https://github.com/edx-solutions/edx-platform","homepage":"http://code.edx.org/","size":285106,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"edx-solutions:master","ref":"master","sha":"4fc281fb11a2b97a17ff8841ce49b9e44dca5280","user":{"login":"edx-solutions","id":6585054,"avatar_url":"https://avatars.githubusercontent.com/u/6585054?v=2","gravatar_id":null,"url":"https://api.github.com/users/edx-solutions","html_url":"https://github.com/edx-solutions","followers_url":"https://api.github.com/users/edx-solutions/followers","following_url":"https://api.github.com/users/edx-solutions/following{/other_user}","gists_url":"https://api.github.com/users/edx-solutions/gists{/gist_id}","starred_url":"https://api.github.com/users/edx-solutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx-solutions/subscriptions","organizations_url":"https://api.github.com/users/edx-solutions/orgs","repos_url":"https://api.github.com/users/edx-solutions/repos","events_url":"https://api.github.com/users/edx-solutions/events{/privacy}","received_events_url":"https://api.github.com/users/edx-solutions/received_events","type":"Organization","site_admin":false},"repo":{"id":16513414,"name":"edx-platform","full_name":"edx-solutions/edx-platform","owner":{"login":"edx-solutions","id":6585054,"avatar_url":"https://avatars.githubusercontent.com/u/6585054?v=2","gravatar_id":null,"url":"https://api.github.com/users/edx-solutions","html_url":"https://github.com/edx-solutions","followers_url":"https://api.github.com/users/edx-solutions/followers","following_url":"https://api.github.com/users/edx-solutions/following{/other_user}","gists_url":"https://api.github.com/users/edx-solutions/gists{/gist_id}","starred_url":"https://api.github.com/users/edx-solutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx-solutions/subscriptions","organizations_url":"https://api.github.com/users/edx-solutions/orgs","repos_url":"https://api.github.com/users/edx-solutions/repos","events_url":"https://api.github.com/users/edx-solutions/events{/privacy}","received_events_url":"https://api.github.com/users/edx-solutions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx-solutions/edx-platform","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/edx-solutions/edx-platform","forks_url":"https://api.github.com/repos/edx-solutions/edx-platform/forks","keys_url":"https://api.github.com/repos/edx-solutions/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx-solutions/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx-solutions/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx-solutions/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx-solutions/edx-platform/events","assignees_url":"https://api.github.com/repos/edx-solutions/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx-solutions/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx-solutions/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx-solutions/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx-solutions/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx-solutions/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx-solutions/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx-solutions/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx-solutions/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx-solutions/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx-solutions/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx-solutions/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx-solutions/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx-solutions/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx-solutions/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx-solutions/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx-solutions/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx-solutions/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx-solutions/edx-platform/merges","archive_url":"https://api.github.com/repos/edx-solutions/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx-solutions/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx-solutions/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx-solutions/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx-solutions/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx-solutions/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx-solutions/edx-platform/releases{/id}","created_at":"2014-02-04T14:02:57Z","updated_at":"2014-08-11T19:43:41Z","pushed_at":"2014-08-20T21:07:12Z","git_url":"git://github.com/edx-solutions/edx-platform.git","ssh_url":"git@github.com:edx-solutions/edx-platform.git","clone_url":"https://github.com/edx-solutions/edx-platform.git","svn_url":"https://github.com/edx-solutions/edx-platform","homepage":"http://code.edx.org/","size":285106,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/189"},"html":{"href":"https://github.com/edx-solutions/edx-platform/pull/189"},"issue":{"href":"https://api.github.com/repos/edx-solutions/edx-platform/issues/189"},"comments":{"href":"https://api.github.com/repos/edx-solutions/edx-platform/issues/189/comments"},"review_comments":{"href":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/189/comments"},"review_comment":{"href":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/189/commits"},"statuses":{"href":"https://api.github.com/repos/edx-solutions/edx-platform/statuses/121c0e72957963e145eef4562a7fb09370d626d8"}}}}