{"action":"created","comment":{"url":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/comments/35767806","id":35767806,"diff_hunk":"@@ -772,6 +772,49 @@ def extract_user_info(user):\n @ensure_csrf_cookie\n @cache_control(no_cache=True, no_store=True, must_revalidate=True)\n @require_level('staff')\n+def get_problem_responses(request, course_id):\n+    \"\"\"\n+    Initiate generation of a CSV file containing all student answers\n+    to a given problem.\n+\n+    Responds with JSON\n+        {\"status\": \"... status message ...\"}\n+\n+    if initiation is successful (or generation task is already running).\n+\n+    Responds with BadRequest if problem URL is faulty.\n+    \"\"\"\n+    course_key = CourseKey.from_string(course_id)\n+    problem_url = request.GET.get('problem_url', '')\n+\n+    if problem_url[-4:] == \".xml\":\n+        problem_url = problem_url[:-4]\n+\n+    try:\n+        course_key.make_usage_key_from_deprecated_string(problem_url)\n+    except InvalidKeyError:\n+        problem_not_found_status = _(\"Could not find problem with this URL.\")\n+        return JsonResponseBadRequest(problem_not_found_status)","path":"lms/djangoapps/instructor/views/api.py","position":32,"original_position":35,"commit_id":"e3761309c97edbd5f572f8b2105ad742e6102701","original_commit_id":"c57b38cc9981e76162712d2d65d559696b5e89cb","user":{"login":"bradenmacdonald","id":945577,"avatar_url":"https://avatars.githubusercontent.com/u/945577?v=3","gravatar_id":"","url":"https://api.github.com/users/bradenmacdonald","html_url":"https://github.com/bradenmacdonald","followers_url":"https://api.github.com/users/bradenmacdonald/followers","following_url":"https://api.github.com/users/bradenmacdonald/following{/other_user}","gists_url":"https://api.github.com/users/bradenmacdonald/gists{/gist_id}","starred_url":"https://api.github.com/users/bradenmacdonald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradenmacdonald/subscriptions","organizations_url":"https://api.github.com/users/bradenmacdonald/orgs","repos_url":"https://api.github.com/users/bradenmacdonald/repos","events_url":"https://api.github.com/users/bradenmacdonald/events{/privacy}","received_events_url":"https://api.github.com/users/bradenmacdonald/received_events","type":"User","site_admin":false},"body":"@itsjeyd  Ah, sorry. `problem_key.course_key` is what you want :)","created_at":"2015-07-29T14:47:11Z","updated_at":"2015-07-29T14:47:11Z","html_url":"https://github.com/rue89-tech/edx-platform/pull/1#discussion_r35767806","pull_request_url":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/comments/35767806"},"html":{"href":"https://github.com/rue89-tech/edx-platform/pull/1#discussion_r35767806"},"pull_request":{"href":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/1","id":40911779,"html_url":"https://github.com/rue89-tech/edx-platform/pull/1","diff_url":"https://github.com/rue89-tech/edx-platform/pull/1.diff","patch_url":"https://github.com/rue89-tech/edx-platform/pull/1.patch","issue_url":"https://api.github.com/repos/rue89-tech/edx-platform/issues/1","number":1,"state":"open","locked":false,"title":"Answer export and course timeline info for new instructor dashboard (OC-791)","user":{"login":"itsjeyd","id":961441,"avatar_url":"https://avatars.githubusercontent.com/u/961441?v=3","gravatar_id":"","url":"https://api.github.com/users/itsjeyd","html_url":"https://github.com/itsjeyd","followers_url":"https://api.github.com/users/itsjeyd/followers","following_url":"https://api.github.com/users/itsjeyd/following{/other_user}","gists_url":"https://api.github.com/users/itsjeyd/gists{/gist_id}","starred_url":"https://api.github.com/users/itsjeyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsjeyd/subscriptions","organizations_url":"https://api.github.com/users/itsjeyd/orgs","repos_url":"https://api.github.com/users/itsjeyd/repos","events_url":"https://api.github.com/users/itsjeyd/events{/privacy}","received_events_url":"https://api.github.com/users/itsjeyd/received_events","type":"User","site_admin":false},"body":"This PR moves functionality for exporting a CSV file listing student responses to a given problem from the legacy instructor dashboard to the new instructor dashboard. It also makes information about a course's timeline (start date, end date, and number of sections/weeks) available on the \"Course Info\" tab of the instructor dashboard.\r\n\r\nLike other types of reports that can be generated from the instructor dashboard, CSV files listing problem responses are prepared asynchronously. When they are ready they can be downloaded from the \"Reports Available for Download\" section at the bottom of the page.\r\n\r\n### Screenshots\r\n\r\n#### \"Data Download\" tab:\r\n\r\n-   Export controls:\r\n    \r\n![problem-responses-export](https://cloud.githubusercontent.com/assets/961441/8908992/629319c4-347f-11e5-8dd6-1bf78ff77e80.png)\r\n\r\n-   Export results:\r\n\r\n![problem-responses-export-results](https://cloud.githubusercontent.com/assets/961441/8909006/7a5679de-347f-11e5-965f-a5af6b8e3c75.png)\r\n\r\n#### Legacy instructor dashboard\r\n\r\nMessage displaying information about where to find functionality for exporting problem responses:\r\n\r\n![legacy-instructor-dashboard-message](https://cloud.githubusercontent.com/assets/961441/8909021/8f202cf2-347f-11e5-9c03-f63f3fdf55c6.png)\r\n\r\n#### \"Course Info\" tab\r\n\r\nTimeline information:\r\n\r\n![course-info-with-start-date-end-date-num-sections](https://cloud.githubusercontent.com/assets/961441/8909030/9dc34ed8-347f-11e5-90e7-031c2b028a86.png)\r\n\r\n**Testing**\r\n\r\n1. Log in to Studio as `staff` user.\r\n2. Create course and add a section, subsection, and unit.\r\n3. Add problem (e.g. \"Text Input\") to unit and publish section.\r\n4. Navigate to unit in LMS and provide answer to problem added in previous step.\r\n5. Click \"Staff Debug Info\" and copy problem URL (= value of `location` attribute, e.g. `i4x://edX/DemoX/problem/9cee77a606ea4c1aa5440e0ea5d0f618`).\r\n6. Navigate to \"Data Download\" tab of instructor dashboard.\r\n7. Paste problem URL into input field (\"Problem URL:\") and click button below (\"Download a CSV of problem responses\").\r\n\r\nOnce the CSV file becomes available for download, navigate to `/tmp/edx-s3/grades/<name-of-course>/` in Devstack and do `cat <name-of-file>.csv` to verify export results.","created_at":"2015-07-27T14:55:06Z","updated_at":"2015-07-29T14:47:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62ed781240bdab3ad88673f6edc9d0328626c357","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/1/commits","review_comments_url":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/1/comments","review_comment_url":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rue89-tech/edx-platform/issues/1/comments","statuses_url":"https://api.github.com/repos/rue89-tech/edx-platform/statuses/e3761309c97edbd5f572f8b2105ad742e6102701","head":{"label":"open-craft:OC-791-answer-export-course-timeline","ref":"OC-791-answer-export-course-timeline","sha":"e3761309c97edbd5f572f8b2105ad742e6102701","user":{"login":"open-craft","id":7414786,"avatar_url":"https://avatars.githubusercontent.com/u/7414786?v=3","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://avatars.githubusercontent.com/u/7414786?v=3","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}","created_at":"2014-05-19T12:28:25Z","updated_at":"2014-12-10T07:44:28Z","pushed_at":"2015-07-29T10:21:48Z","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":460252,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"rue89-tech:rue89-stage","ref":"rue89-stage","sha":"f0754175b4f6d587c5fa261f814355c4010462e4","user":{"login":"rue89-tech","id":3500245,"avatar_url":"https://avatars.githubusercontent.com/u/3500245?v=3","gravatar_id":"","url":"https://api.github.com/users/rue89-tech","html_url":"https://github.com/rue89-tech","followers_url":"https://api.github.com/users/rue89-tech/followers","following_url":"https://api.github.com/users/rue89-tech/following{/other_user}","gists_url":"https://api.github.com/users/rue89-tech/gists{/gist_id}","starred_url":"https://api.github.com/users/rue89-tech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rue89-tech/subscriptions","organizations_url":"https://api.github.com/users/rue89-tech/orgs","repos_url":"https://api.github.com/users/rue89-tech/repos","events_url":"https://api.github.com/users/rue89-tech/events{/privacy}","received_events_url":"https://api.github.com/users/rue89-tech/received_events","type":"Organization","site_admin":false},"repo":{"id":35083509,"name":"edx-platform","full_name":"rue89-tech/edx-platform","owner":{"login":"rue89-tech","id":3500245,"avatar_url":"https://avatars.githubusercontent.com/u/3500245?v=3","gravatar_id":"","url":"https://api.github.com/users/rue89-tech","html_url":"https://github.com/rue89-tech","followers_url":"https://api.github.com/users/rue89-tech/followers","following_url":"https://api.github.com/users/rue89-tech/following{/other_user}","gists_url":"https://api.github.com/users/rue89-tech/gists{/gist_id}","starred_url":"https://api.github.com/users/rue89-tech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rue89-tech/subscriptions","organizations_url":"https://api.github.com/users/rue89-tech/orgs","repos_url":"https://api.github.com/users/rue89-tech/repos","events_url":"https://api.github.com/users/rue89-tech/events{/privacy}","received_events_url":"https://api.github.com/users/rue89-tech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rue89-tech/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":true,"url":"https://api.github.com/repos/rue89-tech/edx-platform","forks_url":"https://api.github.com/repos/rue89-tech/edx-platform/forks","keys_url":"https://api.github.com/repos/rue89-tech/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rue89-tech/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rue89-tech/edx-platform/teams","hooks_url":"https://api.github.com/repos/rue89-tech/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/rue89-tech/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/rue89-tech/edx-platform/events","assignees_url":"https://api.github.com/repos/rue89-tech/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/rue89-tech/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/rue89-tech/edx-platform/tags","blobs_url":"https://api.github.com/repos/rue89-tech/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rue89-tech/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rue89-tech/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/rue89-tech/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rue89-tech/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/rue89-tech/edx-platform/languages","stargazers_url":"https://api.github.com/repos/rue89-tech/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/rue89-tech/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/rue89-tech/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/rue89-tech/edx-platform/subscription","commits_url":"https://api.github.com/repos/rue89-tech/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/rue89-tech/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/rue89-tech/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/rue89-tech/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/rue89-tech/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/rue89-tech/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rue89-tech/edx-platform/merges","archive_url":"https://api.github.com/repos/rue89-tech/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rue89-tech/edx-platform/downloads","issues_url":"https://api.github.com/repos/rue89-tech/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/rue89-tech/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/rue89-tech/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/rue89-tech/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rue89-tech/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/rue89-tech/edx-platform/releases{/id}","created_at":"2015-05-05T07:04:05Z","updated_at":"2015-05-05T07:04:34Z","pushed_at":"2015-07-29T10:21:58Z","git_url":"git://github.com/rue89-tech/edx-platform.git","ssh_url":"git@github.com:rue89-tech/edx-platform.git","clone_url":"https://github.com/rue89-tech/edx-platform.git","svn_url":"https://github.com/rue89-tech/edx-platform","homepage":"http://openedx.org/","size":503972,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/1"},"html":{"href":"https://github.com/rue89-tech/edx-platform/pull/1"},"issue":{"href":"https://api.github.com/repos/rue89-tech/edx-platform/issues/1"},"comments":{"href":"https://api.github.com/repos/rue89-tech/edx-platform/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rue89-tech/edx-platform/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/rue89-tech/edx-platform/statuses/e3761309c97edbd5f572f8b2105ad742e6102701"}}}}