{"action":"created","comment":{"url":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/comments/116999257","pull_request_review_id":38665466,"id":116999257,"diff_hunk":"@@ -141,6 +146,77 @@ def add_speaker_view(event_id, session_id):\n         return redirect(url_for('.index_view', event_id=event_id))\n \n \n+@event_sessions.route('/download_speakers_as_csv/')\n+@belongs_to_event\n+@can_access\n+def download_speakers_as_csv(event_id):\n+    sessions = DataGetter.get_sessions_by_event_id(event_id)\n+    event = DataGetter.get_event(event_id)\n+    main = []\n+    data = [\"Speaker Name\", \"Speaker Session(s)\", \"Speaker Email\", \"Speaker Status\", \\\n+            \"Speaker Mobile\", \"Speaker Organisation\", \"Speaker Position\"]\n+    main.append(data)\n+    for session in sessions:\n+        for speaker in session.speakers:\n+            data = []\n+            data.append(speaker.name) if speaker.name else data.append('')\n+            data.append(session.title) if session.title else data.append('')\n+            data.append(speaker.email) if speaker.email else data.append('')\n+            if speaker.sessions:\n+                for sess in speaker.sessions:\n+                    data.append(sess.state)\n+            data.append(speaker.mobile) if speaker.mobile else data.append('')\n+            data.append(speaker.organisation) if speaker.organisation else data.append('')\n+            data.append(speaker.position) if speaker.position else data.append('')\n+        main.append(data)\n+\n+    final = StringIO()\n+    csvWriter = writer(final)\n+    csvWriter.writerows(main)\n+    response = make_response(final.getvalue())\n+    final.close()\n+    response.headers['Content-Type'] = 'text/csv'\n+    response.headers['Content-Disposition'] = \\\n+        'inline; filename=%s-Speakers.csv' % (re.sub(r\"[^\\w\\s]\", '', event.name).replace(\" \", \"_\"))\n+\n+    return response\n+\n+\n+@event_sessions.route('/download_sessions_as_csv/')\n+@belongs_to_event\n+@can_access\n+def download_sessions_as_csv(event_id):\n+    sessions = DataGetter.get_sessions_by_event_id(event_id)\n+    event = DataGetter.get_event(event_id)\n+    main = []\n+    data = [\"Session Status\", \"Session Title\", \"Session Speakers\", \\\n+            \"Session Track\", \"Session Abstract\", \"Email Sent\"]\n+    main.append(data)\n+    for session in sessions:\n+        data = []\n+        data.append(session.state) if session.state else data.append(' ')","path":"app/views/users/sessions.py","position":71,"original_position":71,"commit_id":"ab0d7212219d16c7fb18ff541fbc7d500592d118","original_commit_id":"ab0d7212219d16c7fb18ff541fbc7d500592d118","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars2.githubusercontent.com/u/19940114?v=3","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Expression \"data.append(session.state) if session.state else data.append('')\" is assigned to nothing](https://www.codacy.com/app/niranjan94/open-event-orga-server/pullRequest?prid=639044)","created_at":"2017-05-17T13:26:57Z","updated_at":"2017-05-17T13:26:57Z","html_url":"https://github.com/fossasia/open-event-orga-server/pull/3572#discussion_r116999257","pull_request_url":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/3572","_links":{"self":{"href":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/comments/116999257"},"html":{"href":"https://github.com/fossasia/open-event-orga-server/pull/3572#discussion_r116999257"},"pull_request":{"href":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/3572"}}},"pull_request":{"url":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/3572","id":119341973,"html_url":"https://github.com/fossasia/open-event-orga-server/pull/3572","diff_url":"https://github.com/fossasia/open-event-orga-server/pull/3572.diff","patch_url":"https://github.com/fossasia/open-event-orga-server/pull/3572.patch","issue_url":"https://api.github.com/repos/fossasia/open-event-orga-server/issues/3572","number":3572,"state":"open","locked":false,"title":"Added \"Export As CSV\" functionality in sessions and speakers tab - Solving Issue#3561","user":{"login":"LuD1161","id":17861054,"avatar_url":"https://avatars0.githubusercontent.com/u/17861054?v=3","gravatar_id":"","url":"https://api.github.com/users/LuD1161","html_url":"https://github.com/LuD1161","followers_url":"https://api.github.com/users/LuD1161/followers","following_url":"https://api.github.com/users/LuD1161/following{/other_user}","gists_url":"https://api.github.com/users/LuD1161/gists{/gist_id}","starred_url":"https://api.github.com/users/LuD1161/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LuD1161/subscriptions","organizations_url":"https://api.github.com/users/LuD1161/orgs","repos_url":"https://api.github.com/users/LuD1161/repos","events_url":"https://api.github.com/users/LuD1161/events{/privacy}","received_events_url":"https://api.github.com/users/LuD1161/received_events","type":"User","site_admin":false},"body":"Added 'Export As CSV' button to these pages\r\nAdded 'Export As CSV' functionality to speakers and sessions\r\n\r\n\r\n### The CSV files\r\n\r\n[Here is the zip file including both the csv files](https://github.com/fossasia/open-event-orga-server/files/992043/csv-files.zip)\r\n\r\n\r\n### Output : \r\n#### On the speakers' tab\r\n![screenshot from 2017-05-07 20-20-02](https://cloud.githubusercontent.com/assets/17861054/25782234/67b2697e-3364-11e7-9288-7a0704c6f6f2.png)\r\n\r\n#### The speaker's csv file\r\n![screenshot from 2017-05-07 20-20-32](https://cloud.githubusercontent.com/assets/17861054/25782235/67b6f854-3364-11e7-8960-cb3a59ec91b7.png)\r\n\r\n#### On the sessions tab\r\n![screenshot from 2017-05-07 20-19-57](https://cloud.githubusercontent.com/assets/17861054/25782233/67b10aac-3364-11e7-9223-1b19f14edfb0.png)\r\n\r\n#### The session's csv file\r\n![output-issue3561-csv](https://cloud.githubusercontent.com/assets/17861054/25782232/67b07ad8-3364-11e7-9914-3fc48fce07ce.png)\r\n\r\nResolves #3561 ","created_at":"2017-05-07T15:06:14Z","updated_at":"2017-05-17T13:26:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"731fec53aa75388927b9cd7fcdf03a24018047d3","assignee":null,"assignees":[],"requested_reviewers":[{"login":"aviaryan","id":4047597,"avatar_url":"https://avatars0.githubusercontent.com/u/4047597?v=3","gravatar_id":"","url":"https://api.github.com/users/aviaryan","html_url":"https://github.com/aviaryan","followers_url":"https://api.github.com/users/aviaryan/followers","following_url":"https://api.github.com/users/aviaryan/following{/other_user}","gists_url":"https://api.github.com/users/aviaryan/gists{/gist_id}","starred_url":"https://api.github.com/users/aviaryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviaryan/subscriptions","organizations_url":"https://api.github.com/users/aviaryan/orgs","repos_url":"https://api.github.com/users/aviaryan/repos","events_url":"https://api.github.com/users/aviaryan/events{/privacy}","received_events_url":"https://api.github.com/users/aviaryan/received_events","type":"User","site_admin":false},{"login":"magdalenesuo","id":20799954,"avatar_url":"https://avatars1.githubusercontent.com/u/20799954?v=3","gravatar_id":"","url":"https://api.github.com/users/magdalenesuo","html_url":"https://github.com/magdalenesuo","followers_url":"https://api.github.com/users/magdalenesuo/followers","following_url":"https://api.github.com/users/magdalenesuo/following{/other_user}","gists_url":"https://api.github.com/users/magdalenesuo/gists{/gist_id}","starred_url":"https://api.github.com/users/magdalenesuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magdalenesuo/subscriptions","organizations_url":"https://api.github.com/users/magdalenesuo/orgs","repos_url":"https://api.github.com/users/magdalenesuo/repos","events_url":"https://api.github.com/users/magdalenesuo/events{/privacy}","received_events_url":"https://api.github.com/users/magdalenesuo/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/3572/commits","review_comments_url":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/3572/comments","review_comment_url":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fossasia/open-event-orga-server/issues/3572/comments","statuses_url":"https://api.github.com/repos/fossasia/open-event-orga-server/statuses/ab0d7212219d16c7fb18ff541fbc7d500592d118","head":{"label":"LuD1161:issue3561","ref":"issue3561","sha":"ab0d7212219d16c7fb18ff541fbc7d500592d118","user":{"login":"LuD1161","id":17861054,"avatar_url":"https://avatars0.githubusercontent.com/u/17861054?v=3","gravatar_id":"","url":"https://api.github.com/users/LuD1161","html_url":"https://github.com/LuD1161","followers_url":"https://api.github.com/users/LuD1161/followers","following_url":"https://api.github.com/users/LuD1161/following{/other_user}","gists_url":"https://api.github.com/users/LuD1161/gists{/gist_id}","starred_url":"https://api.github.com/users/LuD1161/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LuD1161/subscriptions","organizations_url":"https://api.github.com/users/LuD1161/orgs","repos_url":"https://api.github.com/users/LuD1161/repos","events_url":"https://api.github.com/users/LuD1161/events{/privacy}","received_events_url":"https://api.github.com/users/LuD1161/received_events","type":"User","site_admin":false},"repo":{"id":85052724,"name":"open-event-orga-server","full_name":"LuD1161/open-event-orga-server","owner":{"login":"LuD1161","id":17861054,"avatar_url":"https://avatars0.githubusercontent.com/u/17861054?v=3","gravatar_id":"","url":"https://api.github.com/users/LuD1161","html_url":"https://github.com/LuD1161","followers_url":"https://api.github.com/users/LuD1161/followers","following_url":"https://api.github.com/users/LuD1161/following{/other_user}","gists_url":"https://api.github.com/users/LuD1161/gists{/gist_id}","starred_url":"https://api.github.com/users/LuD1161/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LuD1161/subscriptions","organizations_url":"https://api.github.com/users/LuD1161/orgs","repos_url":"https://api.github.com/users/LuD1161/repos","events_url":"https://api.github.com/users/LuD1161/events{/privacy}","received_events_url":"https://api.github.com/users/LuD1161/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/LuD1161/open-event-orga-server","description":"The Open Event Organizer Server to Manage Events https://eventyay.com","fork":true,"url":"https://api.github.com/repos/LuD1161/open-event-orga-server","forks_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/forks","keys_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/teams","hooks_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/hooks","issue_events_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/issues/events{/number}","events_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/events","assignees_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/assignees{/user}","branches_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/branches{/branch}","tags_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/tags","blobs_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/statuses/{sha}","languages_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/languages","stargazers_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/stargazers","contributors_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/contributors","subscribers_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/subscribers","subscription_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/subscription","commits_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/contents/{+path}","compare_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/merges","archive_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/downloads","issues_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/issues{/number}","pulls_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/pulls{/number}","milestones_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/milestones{/number}","notifications_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/labels{/name}","releases_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/releases{/id}","deployments_url":"https://api.github.com/repos/LuD1161/open-event-orga-server/deployments","created_at":"2017-03-15T09:20:18Z","updated_at":"2017-03-15T09:20:21Z","pushed_at":"2017-05-17T13:23:01Z","git_url":"git://github.com/LuD1161/open-event-orga-server.git","ssh_url":"git@github.com:LuD1161/open-event-orga-server.git","clone_url":"https://github.com/LuD1161/open-event-orga-server.git","svn_url":"https://github.com/LuD1161/open-event-orga-server","homepage":"https://open-event-dev.herokuapp.com","size":41566,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"development"}},"base":{"label":"fossasia:development","ref":"development","sha":"7e691a01e6e5da9af67d1b296654a7eddefaf76e","user":{"login":"fossasia","id":6295529,"avatar_url":"https://avatars0.githubusercontent.com/u/6295529?v=3","gravatar_id":"","url":"https://api.github.com/users/fossasia","html_url":"https://github.com/fossasia","followers_url":"https://api.github.com/users/fossasia/followers","following_url":"https://api.github.com/users/fossasia/following{/other_user}","gists_url":"https://api.github.com/users/fossasia/gists{/gist_id}","starred_url":"https://api.github.com/users/fossasia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fossasia/subscriptions","organizations_url":"https://api.github.com/users/fossasia/orgs","repos_url":"https://api.github.com/users/fossasia/repos","events_url":"https://api.github.com/users/fossasia/events{/privacy}","received_events_url":"https://api.github.com/users/fossasia/received_events","type":"Organization","site_admin":false},"repo":{"id":35270176,"name":"open-event-orga-server","full_name":"fossasia/open-event-orga-server","owner":{"login":"fossasia","id":6295529,"avatar_url":"https://avatars0.githubusercontent.com/u/6295529?v=3","gravatar_id":"","url":"https://api.github.com/users/fossasia","html_url":"https://github.com/fossasia","followers_url":"https://api.github.com/users/fossasia/followers","following_url":"https://api.github.com/users/fossasia/following{/other_user}","gists_url":"https://api.github.com/users/fossasia/gists{/gist_id}","starred_url":"https://api.github.com/users/fossasia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fossasia/subscriptions","organizations_url":"https://api.github.com/users/fossasia/orgs","repos_url":"https://api.github.com/users/fossasia/repos","events_url":"https://api.github.com/users/fossasia/events{/privacy}","received_events_url":"https://api.github.com/users/fossasia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fossasia/open-event-orga-server","description":"The Open Event Organizer Server to Manage Events https://eventyay.com","fork":false,"url":"https://api.github.com/repos/fossasia/open-event-orga-server","forks_url":"https://api.github.com/repos/fossasia/open-event-orga-server/forks","keys_url":"https://api.github.com/repos/fossasia/open-event-orga-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fossasia/open-event-orga-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fossasia/open-event-orga-server/teams","hooks_url":"https://api.github.com/repos/fossasia/open-event-orga-server/hooks","issue_events_url":"https://api.github.com/repos/fossasia/open-event-orga-server/issues/events{/number}","events_url":"https://api.github.com/repos/fossasia/open-event-orga-server/events","assignees_url":"https://api.github.com/repos/fossasia/open-event-orga-server/assignees{/user}","branches_url":"https://api.github.com/repos/fossasia/open-event-orga-server/branches{/branch}","tags_url":"https://api.github.com/repos/fossasia/open-event-orga-server/tags","blobs_url":"https://api.github.com/repos/fossasia/open-event-orga-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fossasia/open-event-orga-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fossasia/open-event-orga-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/fossasia/open-event-orga-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fossasia/open-event-orga-server/statuses/{sha}","languages_url":"https://api.github.com/repos/fossasia/open-event-orga-server/languages","stargazers_url":"https://api.github.com/repos/fossasia/open-event-orga-server/stargazers","contributors_url":"https://api.github.com/repos/fossasia/open-event-orga-server/contributors","subscribers_url":"https://api.github.com/repos/fossasia/open-event-orga-server/subscribers","subscription_url":"https://api.github.com/repos/fossasia/open-event-orga-server/subscription","commits_url":"https://api.github.com/repos/fossasia/open-event-orga-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/fossasia/open-event-orga-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/fossasia/open-event-orga-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/fossasia/open-event-orga-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/fossasia/open-event-orga-server/contents/{+path}","compare_url":"https://api.github.com/repos/fossasia/open-event-orga-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fossasia/open-event-orga-server/merges","archive_url":"https://api.github.com/repos/fossasia/open-event-orga-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fossasia/open-event-orga-server/downloads","issues_url":"https://api.github.com/repos/fossasia/open-event-orga-server/issues{/number}","pulls_url":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls{/number}","milestones_url":"https://api.github.com/repos/fossasia/open-event-orga-server/milestones{/number}","notifications_url":"https://api.github.com/repos/fossasia/open-event-orga-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fossasia/open-event-orga-server/labels{/name}","releases_url":"https://api.github.com/repos/fossasia/open-event-orga-server/releases{/id}","deployments_url":"https://api.github.com/repos/fossasia/open-event-orga-server/deployments","created_at":"2015-05-08T09:16:19Z","updated_at":"2017-05-15T09:37:20Z","pushed_at":"2017-05-17T13:23:04Z","git_url":"git://github.com/fossasia/open-event-orga-server.git","ssh_url":"git@github.com:fossasia/open-event-orga-server.git","clone_url":"https://github.com/fossasia/open-event-orga-server.git","svn_url":"https://github.com/fossasia/open-event-orga-server","homepage":"https://open-event-dev.herokuapp.com","size":41584,"stargazers_count":290,"watchers_count":290,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":306,"mirror_url":null,"open_issues_count":67,"forks":306,"open_issues":67,"watchers":290,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/3572"},"html":{"href":"https://github.com/fossasia/open-event-orga-server/pull/3572"},"issue":{"href":"https://api.github.com/repos/fossasia/open-event-orga-server/issues/3572"},"comments":{"href":"https://api.github.com/repos/fossasia/open-event-orga-server/issues/3572/comments"},"review_comments":{"href":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/3572/comments"},"review_comment":{"href":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fossasia/open-event-orga-server/pulls/3572/commits"},"statuses":{"href":"https://api.github.com/repos/fossasia/open-event-orga-server/statuses/ab0d7212219d16c7fb18ff541fbc7d500592d118"}}}}
{"actor":{"display_login":"codacy-bot"}}