{"action":"created","comment":{"url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/26626685","id":26626685,"diff_hunk":"@@ -164,20 +164,18 @@ def generate_course_forums_query(course_id, query_type, parent_id_check=None):\n     return query\n \n \n-def collect_ora2_data(course_id):\n+def collect_ora2_data(course_id, include_email='False'):\n     \"\"\"\n-    Query MySQL database for aggregated ora2 response data.\n+    Query MySQL database for aggregated ora2 response data. If is_anonymous = false, display student username and emails.\n     \"\"\"\n     cursor = get_read_replica_cursor_if_available(db)\n-\n     #Syntax unsupported by other vendors such as SQLite test db\n     if db.connection.vendor != 'mysql':\n         return '', ['']\n \n-    raw_queries = ora2_data_queries().split(';')\n-    \n+    raw_queries = ora2_data_queries(include_email, course_id).split(';')\n     cursor.execute(raw_queries[0])\n-    cursor.execute(raw_queries[1], [course_id])","path":"lms/djangoapps/instructor/utils.py","position":20,"original_position":20,"commit_id":"2fce4d417beec23bc4e6f9af40c23a32e98c325f","original_commit_id":"2fce4d417beec23bc4e6f9af40c23a32e98c325f","user":{"login":"dylanrhodes","id":1864903,"avatar_url":"https://avatars.githubusercontent.com/u/1864903?v=3","gravatar_id":"","url":"https://api.github.com/users/dylanrhodes","html_url":"https://github.com/dylanrhodes","followers_url":"https://api.github.com/users/dylanrhodes/followers","following_url":"https://api.github.com/users/dylanrhodes/following{/other_user}","gists_url":"https://api.github.com/users/dylanrhodes/gists{/gist_id}","starred_url":"https://api.github.com/users/dylanrhodes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylanrhodes/subscriptions","organizations_url":"https://api.github.com/users/dylanrhodes/orgs","repos_url":"https://api.github.com/users/dylanrhodes/repos","events_url":"https://api.github.com/users/dylanrhodes/events{/privacy}","received_events_url":"https://api.github.com/users/dylanrhodes/received_events","type":"User","site_admin":false},"body":"I would actually prefer to keep this execute line as is.  It's always better to use SQL libraries directly for query parameterization rather than other string substitution methods (like .format below).  Otherwise, you are almost guaranteed to leave yourself open to some form of injection attack, because SQL escaping is really finicky and the generic Python string substitution methods won't handle all of the edge cases correctly (<a href=\"http://xkcd.com/327/\">my favorite XKCD</a>).","created_at":"2015-03-17T23:26:16Z","updated_at":"2015-03-17T23:26:16Z","html_url":"https://github.com/Stanford-Online/edx-platform/pull/236#discussion_r26626685","pull_request_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/236","_links":{"self":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/26626685"},"html":{"href":"https://github.com/Stanford-Online/edx-platform/pull/236#discussion_r26626685"},"pull_request":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/236"}}},"pull_request":{"url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/236","id":30892439,"html_url":"https://github.com/Stanford-Online/edx-platform/pull/236","diff_url":"https://github.com/Stanford-Online/edx-platform/pull/236.diff","patch_url":"https://github.com/Stanford-Online/edx-platform/pull/236.patch","issue_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/236","number":236,"state":"open","locked":false,"title":"LE-66: A new ORA2 student responses report with emails addresses.","user":{"login":"lydiali","id":4624723,"avatar_url":"https://avatars.githubusercontent.com/u/4624723?v=3","gravatar_id":"","url":"https://api.github.com/users/lydiali","html_url":"https://github.com/lydiali","followers_url":"https://api.github.com/users/lydiali/followers","following_url":"https://api.github.com/users/lydiali/following{/other_user}","gists_url":"https://api.github.com/users/lydiali/gists{/gist_id}","starred_url":"https://api.github.com/users/lydiali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydiali/subscriptions","organizations_url":"https://api.github.com/users/lydiali/orgs","repos_url":"https://api.github.com/users/lydiali/repos","events_url":"https://api.github.com/users/lydiali/events{/privacy}","received_events_url":"https://api.github.com/users/lydiali/received_events","type":"User","site_admin":false},"body":"The ORA2 student responses report download (accessible from instructor dashboard -> \"data download\")\r\ndoesn't include the students' email addresses or usernames. We've had requests to include this.\r\n\r\nIt'd be ideal if there could be a way to request it both with and without the email addresses / usernames.\r\nOne straightforward way to present that option would be by simply creating an additional button for\r\nthe report including email addresses, and relabelling the existing button.","created_at":"2015-03-10T21:05:45Z","updated_at":"2015-03-17T23:26:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e4aa4c6e2e8a6ad1662027d75cd18fd9cd7f09a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/236/commits","review_comments_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/236/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/236/comments","statuses_url":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/2fce4d417beec23bc4e6f9af40c23a32e98c325f","head":{"label":"Stanford-Online:lydial/ora2downloads_email","ref":"lydial/ora2downloads_email","sha":"2fce4d417beec23bc4e6f9af40c23a32e98c325f","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-03-12T21:18:08Z","pushed_at":"2015-03-17T23:22:55Z","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":397747,"stargazers_count":10,"watchers_count":10,"language":"Gettext Catalog","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":55,"forks":2,"open_issues":55,"watchers":10,"default_branch":"master"}},"base":{"label":"Stanford-Online:master","ref":"master","sha":"3faaad28ac0e6cee7ce339d73cdad5f4a9c33fa4","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-03-12T21:18:08Z","pushed_at":"2015-03-17T23:22:55Z","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":397747,"stargazers_count":10,"watchers_count":10,"language":"Gettext Catalog","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":55,"forks":2,"open_issues":55,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/236"},"html":{"href":"https://github.com/Stanford-Online/edx-platform/pull/236"},"issue":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/236"},"comments":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/236/comments"},"review_comments":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/236/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/236/commits"},"statuses":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/2fce4d417beec23bc4e6f9af40c23a32e98c325f"}}}}