GitHub PullRequestReviewCommentEvent at 2014-07-11 22:25:42
Repository: edx-platform
Actor: jrbl
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/14847137","id":14847137,"diff_hunk":"@@ -0,0 +1,172 @@\n+\"\"\"\n+Views related to bulk settings change operations on course objects.\n+\"\"\"\n+\n+import json\n+import logging\n+import os\n+\n+from collections import OrderedDict\n+\n+from django_future.csrf import ensure_csrf_cookie\n+from django.core.exceptions import PermissionDenied\n+from django.contrib.auth.decorators import login_required\n+from django.core.urlresolvers import reverse\n+\n+from edxmako.shortcuts import render_to_response\n+\n+from contentstore.utils import compute_publish_state\n+\n+from xmodule.modulestore.keys import CourseKey\n+from xmodule.modulestore.django import modulestore\n+from xmodule.modulestore.exceptions import ItemNotFoundError\n+from xmodule.modulestore.inheritance import own_metadata\n+\n+from static_replace import replace_static_urls\n+from ..access import has_course_access\n+from ...utils import get_modulestore\n+\n+log = logging.getLogger(__name__)\n+\n+__all__ = ['utility_bulksettings_handler']\n+\n+COMPONENT_TYPES = ['discussion', 'html', 'problem', 'video']\n+\n+SECTION_SETTING_TYPES = ['start']\n+SUBSECTION_SETTING_TYPES = ['start', 'due', 'format']\n+UNIT_SETTING_TYPES = []\n+PROBLEM_SETTING_TYPES = ['max_attempts', 'weight', 'rerandomize', 'showanswer', 'submission_wait_seconds']\n+SECTION_SETTING_MAP = {'start': 'Release Date'}\n+SUBSECTION_SETTING_MAP = {'start': 'Release', 'due': 'Due', 'format': 'Type'}\n+\n+@login_required\n+def utility_bulksettings_handler(request, course_key_string):\n+    \"\"\"\n+    Handler for bulk settings view requests in the utilities tool.\n+    Queries for all settings for a given section, subsection & xblocks.\n+\n+    In order to reduce the amount of embedding of functions in the template,\n+    store section - subsection - units - problems as list of hashes\n+    \"\"\"\n+    \n+    course_key = CourseKey.from_string(course_key_string)\n+    response_format = request.REQUEST.get('format', 'html')\n+    \n+    if response_format == 'html': \n+        if request.method == 'GET':\n+            \n+            # load data  \n+            course = _get_course_module(course_key, request.user, depth=3)\n+\n+            # traverse into the course tree and extract problem settings information\n+            settings_data = _get_bulksettings_metadata(course)\n+            \n+            return render_to_response('bulksettings.html',\n+                {\n+                    'context_course':course,\n+                    'settings_data':settings_data,\n+                    'section_setting_types': SECTION_SETTING_TYPES,\n+                    'subsection_setting_types': SUBSECTION_SETTING_TYPES,\n+                    'unit_setting_types': UNIT_SETTING_TYPES,\n+                    'problem_setting_types': PROBLEM_SETTING_TYPES,\n+                    'section_setting_map': SECTION_SETTING_MAP,\n+                    'subsection_setting_map': SUBSECTION_SETTING_MAP\n+                }\n+            )\n+\n+def _get_bulksettings_metadata(course):","path":"cms/djangoapps/contentstore/views/utilities/bulksettings.py","position":77,"original_position":77,"commit_id":"c12e7ce65daacd1fb2f5ef1f86a791a56f48bccf","original_commit_id":"c12e7ce65daacd1fb2f5ef1f86a791a56f48bccf","user":{"login":"jrbl","id":105487,"avatar_url":"https://avatars.githubusercontent.com/u/105487?","gravatar_id":"2b33dd084f0e96ec7b6415885e20bf9e","url":"https://api.github.com/users/jrbl","html_url":"https://github.com/jrbl","followers_url":"https://api.github.com/users/jrbl/followers","following_url":"https://api.github.com/users/jrbl/following{/other_user}","gists_url":"https://api.github.com/users/jrbl/gists{/gist_id}","starred_url":"https://api.github.com/users/jrbl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrbl/subscriptions","organizations_url":"https://api.github.com/users/jrbl/orgs","repos_url":"https://api.github.com/users/jrbl/repos","events_url":"https://api.github.com/users/jrbl/events{/privacy}","received_events_url":"https://api.github.com/users/jrbl/received_events","type":"User","site_admin":false},"body":"I think it's worth nitpicking, because I can imagine a generalized method for returning a course structure as a python dict being re-used in other places. I think taking pains to make it both efficient and readable will pay dividends in the future.","created_at":"2014-07-11T22:25:42Z","updated_at":"2014-07-11T22:25:42Z","html_url":"https://github.com/Stanford-Online/edx-platform/pull/72#discussion_r14847137","pull_request_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/72","_links":{"self":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/14847137"},"html":{"href":"https://github.com/Stanford-Online/edx-platform/pull/72#discussion_r14847137"},"pull_request":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/72"}}},"pull_request":{"url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/72","id":18296809,"html_url":"https://github.com/Stanford-Online/edx-platform/pull/72","diff_url":"https://github.com/Stanford-Online/edx-platform/pull/72.diff","patch_url":"https://github.com/Stanford-Online/edx-platform/pull/72.patch","issue_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/72","number":72,"state":"open","title":"Implemented Bulksettings page & Tests","user":{"login":"sjang92","id":3598201,"avatar_url":"https://avatars.githubusercontent.com/u/3598201?","gravatar_id":"af2bbdf3f9802d2b0e3af412983d595e","url":"https://api.github.com/users/sjang92","html_url":"https://github.com/sjang92","followers_url":"https://api.github.com/users/sjang92/followers","following_url":"https://api.github.com/users/sjang92/following{/other_user}","gists_url":"https://api.github.com/users/sjang92/gists{/gist_id}","starred_url":"https://api.github.com/users/sjang92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjang92/subscriptions","organizations_url":"https://api.github.com/users/sjang92/orgs","repos_url":"https://api.github.com/users/sjang92/repos","events_url":"https://api.github.com/users/sjang92/events{/privacy}","received_events_url":"https://api.github.com/users/sjang92/received_events","type":"User","site_admin":false},"body":"From Jane's Story: \r\n\r\n@jinpa @jrbl @nparlante \r\n\r\n\"Proposal: We propose to build a utility which lists, for each problem in the course, its \"settings\", as well as some of the information it inherits from its Subsection, namely: Due Date, Release Date, Grading Type.  Each problem's title can be a link to the Studio page for the unit that the component is a part of, so that if a user spots something on the page that needs editing, they can quickly navigate to the where they can edit it.  Later on, we may make settings editable in-place on this page, perhaps even in bulk, but that won't be part of this release.  \"\r\n\r\n![screen shot 2014-07-11 at 12 04 27 pm](https://cloud.githubusercontent.com/assets/3598201/3557314/43dd1282-092e-11e4-8e9c-8fc4f6f95155.png)\r\n![screen shot 2014-07-11 at 12 04 14 pm](https://cloud.githubusercontent.com/assets/3598201/3557313/43d0a4ca-092e-11e4-9af0-e4bf7be9c235.png)\r\n","created_at":"2014-07-11T19:24:01Z","updated_at":"2014-07-11T22:25:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d086d1db42a8241874dd33e79bc0b9f606648eb8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/72/commits","review_comments_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/72/comments","review_comment_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/72/comments","statuses_url":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/c12e7ce65daacd1fb2f5ef1f86a791a56f48bccf","head":{"label":"Stanford-Online:sjang92/bulk_settings_rebase","ref":"sjang92/bulk_settings_rebase","sha":"c12e7ce65daacd1fb2f5ef1f86a791a56f48bccf","user":{"login":"Stanford-Online","id":2159497,"avatar_url":"https://avatars.githubusercontent.com/u/2159497?","gravatar_id":"867d6ef89cbc4e71bc8d987c08828f38","url":"https://api.github.com/users/Stanford-Online","html_url":"https://github.com/Stanford-Online","followers_url":"https://api.github.com/users/Stanford-Online/followers","following_url":"https://api.github.com/users/Stanford-Online/following{/other_user}","gists_url":"https://api.github.com/users/Stanford-Online/gists{/gist_id}","starred_url":"https://api.github.com/users/Stanford-Online/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stanford-Online/subscriptions","organizations_url":"https://api.github.com/users/Stanford-Online/orgs","repos_url":"https://api.github.com/users/Stanford-Online/repos","events_url":"https://api.github.com/users/Stanford-Online/events{/privacy}","received_events_url":"https://api.github.com/users/Stanford-Online/received_events","type":"Organization","site_admin":false},"repo":{"id":11616657,"name":"edx-platform","full_name":"Stanford-Online/edx-platform","owner":{"login":"Stanford-Online","id":2159497,"avatar_url":"https://avatars.githubusercontent.com/u/2159497?","gravatar_id":"867d6ef89cbc4e71bc8d987c08828f38","url":"https://api.github.com/users/Stanford-Online","html_url":"https://github.com/Stanford-Online","followers_url":"https://api.github.com/users/Stanford-Online/followers","following_url":"https://api.github.com/users/Stanford-Online/following{/other_user}","gists_url":"https://api.github.com/users/Stanford-Online/gists{/gist_id}","starred_url":"https://api.github.com/users/Stanford-Online/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stanford-Online/subscriptions","organizations_url":"https://api.github.com/users/Stanford-Online/orgs","repos_url":"https://api.github.com/users/Stanford-Online/repos","events_url":"https://api.github.com/users/Stanford-Online/events{/privacy}","received_events_url":"https://api.github.com/users/Stanford-Online/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Stanford-Online/edx-platform","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/Stanford-Online/edx-platform","forks_url":"https://api.github.com/repos/Stanford-Online/edx-platform/forks","keys_url":"https://api.github.com/repos/Stanford-Online/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Stanford-Online/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Stanford-Online/edx-platform/teams","hooks_url":"https://api.github.com/repos/Stanford-Online/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/Stanford-Online/edx-platform/events","assignees_url":"https://api.github.com/repos/Stanford-Online/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/Stanford-Online/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/Stanford-Online/edx-platform/tags","blobs_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/Stanford-Online/edx-platform/languages","stargazers_url":"https://api.github.com/repos/Stanford-Online/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/Stanford-Online/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/Stanford-Online/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/Stanford-Online/edx-platform/subscription","commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/Stanford-Online/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/Stanford-Online/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/Stanford-Online/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Stanford-Online/edx-platform/merges","archive_url":"https://api.github.com/repos/Stanford-Online/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Stanford-Online/edx-platform/downloads","issues_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/Stanford-Online/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/Stanford-Online/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Stanford-Online/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/Stanford-Online/edx-platform/releases{/id}","created_at":"2013-07-23T19:05:46Z","updated_at":"2014-07-10T04:02:14Z","pushed_at":"2014-07-11T21:35:39Z","git_url":"git://github.com/Stanford-Online/edx-platform.git","ssh_url":"git@github.com:Stanford-Online/edx-platform.git","clone_url":"https://github.com/Stanford-Online/edx-platform.git","svn_url":"https://github.com/Stanford-Online/edx-platform","homepage":"http://code.edx.org/","size":261658,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":1,"mirror_url":null,"open_issues_count":42,"forks":1,"open_issues":42,"watchers":4,"default_branch":"master"}},"base":{"label":"Stanford-Online:master","ref":"master","sha":"ae5c71dce0642d07355649fd3ebb1d94686d067d","user":{"login":"Stanford-Online","id":2159497,"avatar_url":"https://avatars.githubusercontent.com/u/2159497?","gravatar_id":"867d6ef89cbc4e71bc8d987c08828f38","url":"https://api.github.com/users/Stanford-Online","html_url":"https://github.com/Stanford-Online","followers_url":"https://api.github.com/users/Stanford-Online/followers","following_url":"https://api.github.com/users/Stanford-Online/following{/other_user}","gists_url":"https://api.github.com/users/Stanford-Online/gists{/gist_id}","starred_url":"https://api.github.com/users/Stanford-Online/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stanford-Online/subscriptions","organizations_url":"https://api.github.com/users/Stanford-Online/orgs","repos_url":"https://api.github.com/users/Stanford-Online/repos","events_url":"https://api.github.com/users/Stanford-Online/events{/privacy}","received_events_url":"https://api.github.com/users/Stanford-Online/received_events","type":"Organization","site_admin":false},"repo":{"id":11616657,"name":"edx-platform","full_name":"Stanford-Online/edx-platform","owner":{"login":"Stanford-Online","id":2159497,"avatar_url":"https://avatars.githubusercontent.com/u/2159497?","gravatar_id":"867d6ef89cbc4e71bc8d987c08828f38","url":"https://api.github.com/users/Stanford-Online","html_url":"https://github.com/Stanford-Online","followers_url":"https://api.github.com/users/Stanford-Online/followers","following_url":"https://api.github.com/users/Stanford-Online/following{/other_user}","gists_url":"https://api.github.com/users/Stanford-Online/gists{/gist_id}","starred_url":"https://api.github.com/users/Stanford-Online/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stanford-Online/subscriptions","organizations_url":"https://api.github.com/users/Stanford-Online/orgs","repos_url":"https://api.github.com/users/Stanford-Online/repos","events_url":"https://api.github.com/users/Stanford-Online/events{/privacy}","received_events_url":"https://api.github.com/users/Stanford-Online/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Stanford-Online/edx-platform","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/Stanford-Online/edx-platform","forks_url":"https://api.github.com/repos/Stanford-Online/edx-platform/forks","keys_url":"https://api.github.com/repos/Stanford-Online/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Stanford-Online/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Stanford-Online/edx-platform/teams","hooks_url":"https://api.github.com/repos/Stanford-Online/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/Stanford-Online/edx-platform/events","assignees_url":"https://api.github.com/repos/Stanford-Online/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/Stanford-Online/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/Stanford-Online/edx-platform/tags","blobs_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/Stanford-Online/edx-platform/languages","stargazers_url":"https://api.github.com/repos/Stanford-Online/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/Stanford-Online/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/Stanford-Online/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/Stanford-Online/edx-platform/subscription","commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/Stanford-Online/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/Stanford-Online/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/Stanford-Online/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Stanford-Online/edx-platform/merges","archive_url":"https://api.github.com/repos/Stanford-Online/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Stanford-Online/edx-platform/downloads","issues_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/Stanford-Online/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/Stanford-Online/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Stanford-Online/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/Stanford-Online/edx-platform/releases{/id}","created_at":"2013-07-23T19:05:46Z","updated_at":"2014-07-10T04:02:14Z","pushed_at":"2014-07-11T21:35:39Z","git_url":"git://github.com/Stanford-Online/edx-platform.git","ssh_url":"git@github.com:Stanford-Online/edx-platform.git","clone_url":"https://github.com/Stanford-Online/edx-platform.git","svn_url":"https://github.com/Stanford-Online/edx-platform","homepage":"http://code.edx.org/","size":261658,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":1,"mirror_url":null,"open_issues_count":42,"forks":1,"open_issues":42,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/72"},"html":{"href":"https://github.com/Stanford-Online/edx-platform/pull/72"},"issue":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/72"},"comments":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/72/comments"},"review_comments":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/72/comments"},"review_comment":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/72/commits"},"statuses":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/c12e7ce65daacd1fb2f5ef1f86a791a56f48bccf"}}}}