{"action":"created","comment":{"url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/39098088","id":39098088,"diff_hunk":"@@ -363,10 +338,117 @@ def test_process_analytics_answer_dist_checkbox(self):\n             \"data_by_part\": {\n             },\n             \"message_by_part\": {\n-                \"i4x-A-B-problem-f3ed0ba7f89445ee9a83541e1fc8a2f2_2_1\": \"The analytics cannot be displayed for this question as the number of rows returned did not match the question definition.\"\n+                \"i4x-A-B-problem-f3ed0ba7f89445ee9a83541e1fc8a2f2_2_1\": \"The analytics cannot be displayed for this \"\n+                                                                        \"question as the number of rows returned did \"\n+                                                                        \"not match the question definition.\"\n             },\n             \"last_update_date\": \"Oct 15, 2014 at 10:13 UTC\"\n         }\n \n         return_json = process_analytics_answer_dist(data, question_types_by_part, num_options_by_part)\n         self.assertEquals(json.loads(return_json.content), processed_data)\n+\n+\n+@override_settings(ANALYTICS_DATA_URL='dummy_url',\n+                   ZENDESK_URL='https://zendesk.com')\n+class InlineAnalyticsTest2(ModuleStoreTestCase):\n+    \"\"\" unittest class \"\"\"\n+\n+    def setUp(self):\n+        super(InlineAnalyticsTest2, self).setUp()\n+        self.user = UserFactory.create()\n+        self.factory = RequestFactory()\n+        self.course = CourseFactory.create(\n+            org=\"A\",\n+            number=\"B\",\n+            display_name=\"C\",\n+        )\n+        self.staff = StaffFactory(course_key=self.course.id)\n+        self.instructor = InstructorFactory(course_key=self.course.id)\n+\n+        analytics_data = {\n+            \"module_id\": \"123\",\n+            \"question_types_by_part\": \"radio\",\n+            \"num_options_by_part\": 6,\n+            \"course_id\": \"A/B/C\",\n+        }\n+        json_analytics_data = json.dumps(analytics_data)\n+        self.data = {\"data\": json_analytics_data}\n+        self.zendesk_response = ('A problem has occurred retrieving the data, to report the problem click '\n+                                 '<a href=\"https://zendesk.com/hc/en-us/requests/new\">here</a>')\n+\n+    def test_regular_user(self):\n+\n+        request = self.factory.post('', self.data)\n+        request.user = self.user\n+\n+        response = get_analytics_answer_dist(request)\n+        self.assertEquals(response.content, self.zendesk_response)\n+\n+    @patch('courseware.views.process_analytics_answer_dist')\n+    @patch('courseware.views.Client')\n+    def test_staff_and_url(self, mock_client, mock_process_analytics):\n+\n+        mock_client.return_value.modules.return_value.answer_distribution.return_value = [{}]","path":"lms/djangoapps/courseware/tests/test_inline_analytics_integration.py","position":216,"original_position":216,"commit_id":"10559dd024ec31d7014b605f5c967f2c176ba46d","original_commit_id":"10559dd024ec31d7014b605f5c967f2c176ba46d","user":{"login":"stvstnfrd","id":7300975,"avatar_url":"https://avatars.githubusercontent.com/u/7300975?v=3","gravatar_id":"","url":"https://api.github.com/users/stvstnfrd","html_url":"https://github.com/stvstnfrd","followers_url":"https://api.github.com/users/stvstnfrd/followers","following_url":"https://api.github.com/users/stvstnfrd/following{/other_user}","gists_url":"https://api.github.com/users/stvstnfrd/gists{/gist_id}","starred_url":"https://api.github.com/users/stvstnfrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stvstnfrd/subscriptions","organizations_url":"https://api.github.com/users/stvstnfrd/orgs","repos_url":"https://api.github.com/users/stvstnfrd/repos","events_url":"https://api.github.com/users/stvstnfrd/events{/privacy}","received_events_url":"https://api.github.com/users/stvstnfrd/received_events","type":"User","site_admin":false},"body":"Oh, I see, it is only one; looked like two.","created_at":"2015-09-09T21:20:54Z","updated_at":"2015-09-09T21:20:54Z","html_url":"https://github.com/Stanford-Online/edx-platform/pull/356#discussion_r39098088","pull_request_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/356","_links":{"self":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/39098088"},"html":{"href":"https://github.com/Stanford-Online/edx-platform/pull/356#discussion_r39098088"},"pull_request":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/356"}}},"pull_request":{"url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/356","id":43448013,"html_url":"https://github.com/Stanford-Online/edx-platform/pull/356","diff_url":"https://github.com/Stanford-Online/edx-platform/pull/356.diff","patch_url":"https://github.com/Stanford-Online/edx-platform/pull/356.patch","issue_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/356","number":356,"state":"open","locked":false,"title":"WIP: Display of student analytics in-line on the problem page. (Last Attempt)","user":{"login":"dcadams","id":1840555,"avatar_url":"https://avatars.githubusercontent.com/u/1840555?v=3","gravatar_id":"","url":"https://api.github.com/users/dcadams","html_url":"https://github.com/dcadams","followers_url":"https://api.github.com/users/dcadams/followers","following_url":"https://api.github.com/users/dcadams/following{/other_user}","gists_url":"https://api.github.com/users/dcadams/gists{/gist_id}","starred_url":"https://api.github.com/users/dcadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcadams/subscriptions","organizations_url":"https://api.github.com/users/dcadams/orgs","repos_url":"https://api.github.com/users/dcadams/repos","events_url":"https://api.github.com/users/dcadams/events{/privacy}","received_events_url":"https://api.github.com/users/dcadams/received_events","type":"User","site_admin":false},"body":"Two problem types have graphical display:\r\n\r\n  Radio button\r\n  Checkbox\r\n\r\nThese other problem types display as in-line text:\r\n\r\n  NumericalResponse\r\n  StringResponse\r\n  FormulaResponse\r\n\r\nThe data source is the analytics pipeline via the api.\r\n\r\nThe setting ANALYTICS_DATA_URL is used as an on/off switch for the feature.\r\nThe list of supported problem types is defined in INLINE_ANALYTICS_SUPPORTED_TYPES.\r\n\r\nConflicts:\r\n\tlms/djangoapps/courseware/module_render.py\r\n\tlms/djangoapps/courseware/tests/test_inline_analytics_integration.py\r\n\tlms/djangoapps/courseware/views.py\r\n\tlms/envs/aws.py\r\n\tlms/envs/common.py\r\n\tlms/static/js/inline_analytics.js\r\n\tlms/static/js/spec/main.js\r\n\tlms/templates/inline_analytics.html\r\n\tlms/urls.py\r\n\trequirements/edx/github.txt","created_at":"2015-08-26T20:29:40Z","updated_at":"2015-09-09T21:20:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"da1d6e0bba4dbaa598160efd3cba926cdef984eb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/356/commits","review_comments_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/356/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/356/comments","statuses_url":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/10559dd024ec31d7014b605f5c967f2c176ba46d","head":{"label":"Stanford-Online:dcadams_upstream_last_attempt-to-origin","ref":"dcadams_upstream_last_attempt-to-origin","sha":"10559dd024ec31d7014b605f5c967f2c176ba46d","user":{"login":"Stanford-Online","id":2159497,"avatar_url":"https://avatars.githubusercontent.com/u/2159497?v=3","gravatar_id":"","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?v=3","gravatar_id":"","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":"2015-07-06T06:09:57Z","pushed_at":"2015-09-09T20:36:35Z","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":480651,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":11,"forks":3,"open_issues":11,"watchers":16,"default_branch":"master"}},"base":{"label":"Stanford-Online:master","ref":"master","sha":"495c3a8b4f5190c140f4d55fae711d0838a3d1ea","user":{"login":"Stanford-Online","id":2159497,"avatar_url":"https://avatars.githubusercontent.com/u/2159497?v=3","gravatar_id":"","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?v=3","gravatar_id":"","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":"2015-07-06T06:09:57Z","pushed_at":"2015-09-09T20:36:35Z","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":480651,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":11,"forks":3,"open_issues":11,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/356"},"html":{"href":"https://github.com/Stanford-Online/edx-platform/pull/356"},"issue":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/356"},"comments":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/356/comments"},"review_comments":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/356/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/356/commits"},"statuses":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/10559dd024ec31d7014b605f5c967f2c176ba46d"}}}}