{"action":"created","comment":{"url":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/comments/36597278","id":36597278,"diff_hunk":"@@ -107,14 +207,132 @@ def do_logout(request):\n \n @view_config(route_name=\"question\", renderer='templates/questionpage.jinja2')\n def question(request):\n-    return {}\n+    if request.authenticated_userid:\n+        user = User.get_by_username(request.authenticated_userid)\n+        if request.method == \"POST\":\n+            answer = request.params.get(\"answer\")\n+            question = Question.get_question_by_id(\n+                request.params.get(\"question_id\")\n+            )\n+            if (answer not in [None, ''] and question.id not in\n+               [sub.question_id for sub in Submission.get_all_for_user(user)]):\n+\n+                Submission.new(\n+                    user=user,\n+                    question=question,\n+                    answer=answer\n+                )\n+        questions = Question.all()\n+        if questions:\n+            submissions = Submission.get_all_for_user(user)\n+            l = []\n+            for q in questions:\n+                if q.id not in [s.question_id for s in submissions]:\n+                    l.append(q)","path":"app.py","position":241,"original_position":241,"commit_id":"4ab537f2ef8023410049db7b2e5512f9e6e90f00","original_commit_id":"4ab537f2ef8023410049db7b2e5512f9e6e90f00","user":{"login":"cewing","id":417109,"avatar_url":"https://avatars.githubusercontent.com/u/417109?v=3","gravatar_id":"","url":"https://api.github.com/users/cewing","html_url":"https://github.com/cewing","followers_url":"https://api.github.com/users/cewing/followers","following_url":"https://api.github.com/users/cewing/following{/other_user}","gists_url":"https://api.github.com/users/cewing/gists{/gist_id}","starred_url":"https://api.github.com/users/cewing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cewing/subscriptions","organizations_url":"https://api.github.com/users/cewing/orgs","repos_url":"https://api.github.com/users/cewing/repos","events_url":"https://api.github.com/users/cewing/events{/privacy}","received_events_url":"https://api.github.com/users/cewing/received_events","type":"User","site_admin":false},"body":"I'm feeling like there must be a way to get the list of all questions a user has not yet answered other than this.  The question to ask sql is \"show me all questions where there is not a submission for that question from this user.\"  Doing this would provide a way to avoid one query and a full iteration through the list of questions.  ","created_at":"2015-08-10T01:42:20Z","updated_at":"2015-08-10T01:42:20Z","html_url":"https://github.com/tpeek/Answer-Prediction/pull/27#discussion_r36597278","pull_request_url":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/comments/36597278"},"html":{"href":"https://github.com/tpeek/Answer-Prediction/pull/27#discussion_r36597278"},"pull_request":{"href":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/27","id":40283825,"html_url":"https://github.com/tpeek/Answer-Prediction/pull/27","diff_url":"https://github.com/tpeek/Answer-Prediction/pull/27.diff","patch_url":"https://github.com/tpeek/Answer-Prediction/pull/27.patch","issue_url":"https://api.github.com/repos/tpeek/Answer-Prediction/issues/27","number":27,"state":"open","locked":false,"title":"Beginning to End","user":{"login":"tpeek","id":7531241,"avatar_url":"https://avatars.githubusercontent.com/u/7531241?v=3","gravatar_id":"","url":"https://api.github.com/users/tpeek","html_url":"https://github.com/tpeek","followers_url":"https://api.github.com/users/tpeek/followers","following_url":"https://api.github.com/users/tpeek/following{/other_user}","gists_url":"https://api.github.com/users/tpeek/gists{/gist_id}","starred_url":"https://api.github.com/users/tpeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpeek/subscriptions","organizations_url":"https://api.github.com/users/tpeek/orgs","repos_url":"https://api.github.com/users/tpeek/repos","events_url":"https://api.github.com/users/tpeek/events{/privacy}","received_events_url":"https://api.github.com/users/tpeek/received_events","type":"User","site_admin":false},"body":"This is what you need, right?","created_at":"2015-07-18T01:09:33Z","updated_at":"2015-08-10T01:42:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08de178e34a365daf0dfd2e616df0c77fe233ce9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/27/commits","review_comments_url":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/27/comments","review_comment_url":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tpeek/Answer-Prediction/issues/27/comments","statuses_url":"https://api.github.com/repos/tpeek/Answer-Prediction/statuses/4ab537f2ef8023410049db7b2e5512f9e6e90f00","head":{"label":"tpeek:master","ref":"master","sha":"4ab537f2ef8023410049db7b2e5512f9e6e90f00","user":{"login":"tpeek","id":7531241,"avatar_url":"https://avatars.githubusercontent.com/u/7531241?v=3","gravatar_id":"","url":"https://api.github.com/users/tpeek","html_url":"https://github.com/tpeek","followers_url":"https://api.github.com/users/tpeek/followers","following_url":"https://api.github.com/users/tpeek/following{/other_user}","gists_url":"https://api.github.com/users/tpeek/gists{/gist_id}","starred_url":"https://api.github.com/users/tpeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpeek/subscriptions","organizations_url":"https://api.github.com/users/tpeek/orgs","repos_url":"https://api.github.com/users/tpeek/repos","events_url":"https://api.github.com/users/tpeek/events{/privacy}","received_events_url":"https://api.github.com/users/tpeek/received_events","type":"User","site_admin":false},"repo":{"id":38440582,"name":"Answer-Prediction","full_name":"tpeek/Answer-Prediction","owner":{"login":"tpeek","id":7531241,"avatar_url":"https://avatars.githubusercontent.com/u/7531241?v=3","gravatar_id":"","url":"https://api.github.com/users/tpeek","html_url":"https://github.com/tpeek","followers_url":"https://api.github.com/users/tpeek/followers","following_url":"https://api.github.com/users/tpeek/following{/other_user}","gists_url":"https://api.github.com/users/tpeek/gists{/gist_id}","starred_url":"https://api.github.com/users/tpeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpeek/subscriptions","organizations_url":"https://api.github.com/users/tpeek/orgs","repos_url":"https://api.github.com/users/tpeek/repos","events_url":"https://api.github.com/users/tpeek/events{/privacy}","received_events_url":"https://api.github.com/users/tpeek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tpeek/Answer-Prediction","description":"A Code Fellows group project.","fork":false,"url":"https://api.github.com/repos/tpeek/Answer-Prediction","forks_url":"https://api.github.com/repos/tpeek/Answer-Prediction/forks","keys_url":"https://api.github.com/repos/tpeek/Answer-Prediction/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tpeek/Answer-Prediction/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tpeek/Answer-Prediction/teams","hooks_url":"https://api.github.com/repos/tpeek/Answer-Prediction/hooks","issue_events_url":"https://api.github.com/repos/tpeek/Answer-Prediction/issues/events{/number}","events_url":"https://api.github.com/repos/tpeek/Answer-Prediction/events","assignees_url":"https://api.github.com/repos/tpeek/Answer-Prediction/assignees{/user}","branches_url":"https://api.github.com/repos/tpeek/Answer-Prediction/branches{/branch}","tags_url":"https://api.github.com/repos/tpeek/Answer-Prediction/tags","blobs_url":"https://api.github.com/repos/tpeek/Answer-Prediction/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tpeek/Answer-Prediction/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tpeek/Answer-Prediction/git/refs{/sha}","trees_url":"https://api.github.com/repos/tpeek/Answer-Prediction/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tpeek/Answer-Prediction/statuses/{sha}","languages_url":"https://api.github.com/repos/tpeek/Answer-Prediction/languages","stargazers_url":"https://api.github.com/repos/tpeek/Answer-Prediction/stargazers","contributors_url":"https://api.github.com/repos/tpeek/Answer-Prediction/contributors","subscribers_url":"https://api.github.com/repos/tpeek/Answer-Prediction/subscribers","subscription_url":"https://api.github.com/repos/tpeek/Answer-Prediction/subscription","commits_url":"https://api.github.com/repos/tpeek/Answer-Prediction/commits{/sha}","git_commits_url":"https://api.github.com/repos/tpeek/Answer-Prediction/git/commits{/sha}","comments_url":"https://api.github.com/repos/tpeek/Answer-Prediction/comments{/number}","issue_comment_url":"https://api.github.com/repos/tpeek/Answer-Prediction/issues/comments{/number}","contents_url":"https://api.github.com/repos/tpeek/Answer-Prediction/contents/{+path}","compare_url":"https://api.github.com/repos/tpeek/Answer-Prediction/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tpeek/Answer-Prediction/merges","archive_url":"https://api.github.com/repos/tpeek/Answer-Prediction/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tpeek/Answer-Prediction/downloads","issues_url":"https://api.github.com/repos/tpeek/Answer-Prediction/issues{/number}","pulls_url":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls{/number}","milestones_url":"https://api.github.com/repos/tpeek/Answer-Prediction/milestones{/number}","notifications_url":"https://api.github.com/repos/tpeek/Answer-Prediction/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tpeek/Answer-Prediction/labels{/name}","releases_url":"https://api.github.com/repos/tpeek/Answer-Prediction/releases{/id}","created_at":"2015-07-02T15:24:59Z","updated_at":"2015-07-19T00:07:03Z","pushed_at":"2015-07-18T01:09:34Z","git_url":"git://github.com/tpeek/Answer-Prediction.git","ssh_url":"git@github.com:tpeek/Answer-Prediction.git","clone_url":"https://github.com/tpeek/Answer-Prediction.git","svn_url":"https://github.com/tpeek/Answer-Prediction","homepage":"http://sherlockengine.com","size":1040,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"tpeek:pyramid_skeleton","ref":"pyramid_skeleton","sha":"c3218e4a05a29074906d0bf5256bbb4e276e0dc1","user":{"login":"tpeek","id":7531241,"avatar_url":"https://avatars.githubusercontent.com/u/7531241?v=3","gravatar_id":"","url":"https://api.github.com/users/tpeek","html_url":"https://github.com/tpeek","followers_url":"https://api.github.com/users/tpeek/followers","following_url":"https://api.github.com/users/tpeek/following{/other_user}","gists_url":"https://api.github.com/users/tpeek/gists{/gist_id}","starred_url":"https://api.github.com/users/tpeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpeek/subscriptions","organizations_url":"https://api.github.com/users/tpeek/orgs","repos_url":"https://api.github.com/users/tpeek/repos","events_url":"https://api.github.com/users/tpeek/events{/privacy}","received_events_url":"https://api.github.com/users/tpeek/received_events","type":"User","site_admin":false},"repo":{"id":38440582,"name":"Answer-Prediction","full_name":"tpeek/Answer-Prediction","owner":{"login":"tpeek","id":7531241,"avatar_url":"https://avatars.githubusercontent.com/u/7531241?v=3","gravatar_id":"","url":"https://api.github.com/users/tpeek","html_url":"https://github.com/tpeek","followers_url":"https://api.github.com/users/tpeek/followers","following_url":"https://api.github.com/users/tpeek/following{/other_user}","gists_url":"https://api.github.com/users/tpeek/gists{/gist_id}","starred_url":"https://api.github.com/users/tpeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpeek/subscriptions","organizations_url":"https://api.github.com/users/tpeek/orgs","repos_url":"https://api.github.com/users/tpeek/repos","events_url":"https://api.github.com/users/tpeek/events{/privacy}","received_events_url":"https://api.github.com/users/tpeek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tpeek/Answer-Prediction","description":"A Code Fellows group project.","fork":false,"url":"https://api.github.com/repos/tpeek/Answer-Prediction","forks_url":"https://api.github.com/repos/tpeek/Answer-Prediction/forks","keys_url":"https://api.github.com/repos/tpeek/Answer-Prediction/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tpeek/Answer-Prediction/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tpeek/Answer-Prediction/teams","hooks_url":"https://api.github.com/repos/tpeek/Answer-Prediction/hooks","issue_events_url":"https://api.github.com/repos/tpeek/Answer-Prediction/issues/events{/number}","events_url":"https://api.github.com/repos/tpeek/Answer-Prediction/events","assignees_url":"https://api.github.com/repos/tpeek/Answer-Prediction/assignees{/user}","branches_url":"https://api.github.com/repos/tpeek/Answer-Prediction/branches{/branch}","tags_url":"https://api.github.com/repos/tpeek/Answer-Prediction/tags","blobs_url":"https://api.github.com/repos/tpeek/Answer-Prediction/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tpeek/Answer-Prediction/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tpeek/Answer-Prediction/git/refs{/sha}","trees_url":"https://api.github.com/repos/tpeek/Answer-Prediction/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tpeek/Answer-Prediction/statuses/{sha}","languages_url":"https://api.github.com/repos/tpeek/Answer-Prediction/languages","stargazers_url":"https://api.github.com/repos/tpeek/Answer-Prediction/stargazers","contributors_url":"https://api.github.com/repos/tpeek/Answer-Prediction/contributors","subscribers_url":"https://api.github.com/repos/tpeek/Answer-Prediction/subscribers","subscription_url":"https://api.github.com/repos/tpeek/Answer-Prediction/subscription","commits_url":"https://api.github.com/repos/tpeek/Answer-Prediction/commits{/sha}","git_commits_url":"https://api.github.com/repos/tpeek/Answer-Prediction/git/commits{/sha}","comments_url":"https://api.github.com/repos/tpeek/Answer-Prediction/comments{/number}","issue_comment_url":"https://api.github.com/repos/tpeek/Answer-Prediction/issues/comments{/number}","contents_url":"https://api.github.com/repos/tpeek/Answer-Prediction/contents/{+path}","compare_url":"https://api.github.com/repos/tpeek/Answer-Prediction/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tpeek/Answer-Prediction/merges","archive_url":"https://api.github.com/repos/tpeek/Answer-Prediction/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tpeek/Answer-Prediction/downloads","issues_url":"https://api.github.com/repos/tpeek/Answer-Prediction/issues{/number}","pulls_url":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls{/number}","milestones_url":"https://api.github.com/repos/tpeek/Answer-Prediction/milestones{/number}","notifications_url":"https://api.github.com/repos/tpeek/Answer-Prediction/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tpeek/Answer-Prediction/labels{/name}","releases_url":"https://api.github.com/repos/tpeek/Answer-Prediction/releases{/id}","created_at":"2015-07-02T15:24:59Z","updated_at":"2015-07-19T00:07:03Z","pushed_at":"2015-07-18T01:09:34Z","git_url":"git://github.com/tpeek/Answer-Prediction.git","ssh_url":"git@github.com:tpeek/Answer-Prediction.git","clone_url":"https://github.com/tpeek/Answer-Prediction.git","svn_url":"https://github.com/tpeek/Answer-Prediction","homepage":"http://sherlockengine.com","size":1040,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/27"},"html":{"href":"https://github.com/tpeek/Answer-Prediction/pull/27"},"issue":{"href":"https://api.github.com/repos/tpeek/Answer-Prediction/issues/27"},"comments":{"href":"https://api.github.com/repos/tpeek/Answer-Prediction/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tpeek/Answer-Prediction/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/tpeek/Answer-Prediction/statuses/4ab537f2ef8023410049db7b2e5512f9e6e90f00"}}}}