{"action":"created","comment":{"url":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/comments/227167368","pull_request_review_id":167141526,"id":227167368,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNzE2NzM2OA==","diff_hunk":"@@ -0,0 +1,158 @@\n+const express = require(\"express\");\n+const router = express.Router();\n+const knex = require(\"../db/client\");\n+const shuffle = require('shuffle-array');\n+\n+router.get(\"/\", (req, res) => {\n+  knex(\"cohorts\")\n+    .then(cohorts => {\n+      knex('members')\n+        .then(members => {\n+          const groups = {};\n+          members.forEach(member => {\n+            if (groups[member.cohort]) {\n+              groups[member.cohort].push(member.name)\n+            } else {\n+              groups[member.cohort] = [member.name]\n+            }\n+          });\n+          res.render(\"cohorts/index\", { cohorts: cohorts, groups: groups });\n+        })\n+    });\n+})\n+\n+router.get(\"/new\", (req, res) => {\n+  res.render(\"cohorts/new\")\n+})\n+\n+router.get(\"/:id\", (req, res) => {\n+  const id = req.params.id;\n+  const assign = {};\n+  assign[req.query.option] = req.query.quantity;\n+  knex('members')\n+    .where('cohort', id)\n+    .then(members => {\n+      knex(\"cohorts\")\n+        .where('id', id)\n+        .first()\n+        .then(cohort => {\n+          const teams = getTeams(members, assign);\n+          res.render(`cohorts/show`, { cohort: cohort, members: members, teams: teams, query: req.query })\n+        })\n+    })\n+})\n+\n+router.post(\"/new\", (req, res) => {\n+  knex('cohorts')\n+    .insert({\n+      name: req.body.name,\n+      logoUrl: req.body.logoUrl\n+    })\n+    .returning(\"*\")\n+    .then(cohort => {\n+      const members = req.body.members","path":"superTeamPicker/routes/cohorts.js","position":53,"original_position":53,"commit_id":"eca5652e7b887927e2c7dda475699aac762d02ca","original_commit_id":"eca5652e7b887927e2c7dda475699aac762d02ca","user":{"login":"tylersuzukinelson","id":5521117,"node_id":"MDQ6VXNlcjU1MjExMTc=","avatar_url":"https://avatars0.githubusercontent.com/u/5521117?v=4","gravatar_id":"","url":"https://api.github.com/users/tylersuzukinelson","html_url":"https://github.com/tylersuzukinelson","followers_url":"https://api.github.com/users/tylersuzukinelson/followers","following_url":"https://api.github.com/users/tylersuzukinelson/following{/other_user}","gists_url":"https://api.github.com/users/tylersuzukinelson/gists{/gist_id}","starred_url":"https://api.github.com/users/tylersuzukinelson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylersuzukinelson/subscriptions","organizations_url":"https://api.github.com/users/tylersuzukinelson/orgs","repos_url":"https://api.github.com/users/tylersuzukinelson/repos","events_url":"https://api.github.com/users/tylersuzukinelson/events{/privacy}","received_events_url":"https://api.github.com/users/tylersuzukinelson/received_events","type":"User","site_admin":false},"body":"This logic may be better in a helper function.","created_at":"2018-10-22T23:01:33Z","updated_at":"2018-10-22T23:07:39Z","html_url":"https://github.com/orsolyabus/codecore_homework/pull/4#discussion_r227167368","pull_request_url":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/4","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/comments/227167368"},"html":{"href":"https://github.com/orsolyabus/codecore_homework/pull/4#discussion_r227167368"},"pull_request":{"href":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/4","id":224021373,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0MDIxMzcz","html_url":"https://github.com/orsolyabus/codecore_homework/pull/4","diff_url":"https://github.com/orsolyabus/codecore_homework/pull/4.diff","patch_url":"https://github.com/orsolyabus/codecore_homework/pull/4.patch","issue_url":"https://api.github.com/repos/orsolyabus/codecore_homework/issues/4","number":4,"state":"open","locked":false,"title":"Super team picker","user":{"login":"orsolyabus","id":23640710,"node_id":"MDQ6VXNlcjIzNjQwNzEw","avatar_url":"https://avatars2.githubusercontent.com/u/23640710?v=4","gravatar_id":"","url":"https://api.github.com/users/orsolyabus","html_url":"https://github.com/orsolyabus","followers_url":"https://api.github.com/users/orsolyabus/followers","following_url":"https://api.github.com/users/orsolyabus/following{/other_user}","gists_url":"https://api.github.com/users/orsolyabus/gists{/gist_id}","starred_url":"https://api.github.com/users/orsolyabus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orsolyabus/subscriptions","organizations_url":"https://api.github.com/users/orsolyabus/orgs","repos_url":"https://api.github.com/users/orsolyabus/repos","events_url":"https://api.github.com/users/orsolyabus/events{/privacy}","received_events_url":"https://api.github.com/users/orsolyabus/received_events","type":"User","site_admin":false},"body":"Hi! \r\nI just finished the week 5 homework.\r\nPlease review.","created_at":"2018-10-18T16:29:27Z","updated_at":"2018-10-22T23:07:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"54a79575974cca7210adbe628199bc1a4271797d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/4/commits","review_comments_url":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/4/comments","review_comment_url":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/orsolyabus/codecore_homework/issues/4/comments","statuses_url":"https://api.github.com/repos/orsolyabus/codecore_homework/statuses/eca5652e7b887927e2c7dda475699aac762d02ca","head":{"label":"orsolyabus:superTeamPicker","ref":"superTeamPicker","sha":"eca5652e7b887927e2c7dda475699aac762d02ca","user":{"login":"orsolyabus","id":23640710,"node_id":"MDQ6VXNlcjIzNjQwNzEw","avatar_url":"https://avatars2.githubusercontent.com/u/23640710?v=4","gravatar_id":"","url":"https://api.github.com/users/orsolyabus","html_url":"https://github.com/orsolyabus","followers_url":"https://api.github.com/users/orsolyabus/followers","following_url":"https://api.github.com/users/orsolyabus/following{/other_user}","gists_url":"https://api.github.com/users/orsolyabus/gists{/gist_id}","starred_url":"https://api.github.com/users/orsolyabus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orsolyabus/subscriptions","organizations_url":"https://api.github.com/users/orsolyabus/orgs","repos_url":"https://api.github.com/users/orsolyabus/repos","events_url":"https://api.github.com/users/orsolyabus/events{/privacy}","received_events_url":"https://api.github.com/users/orsolyabus/received_events","type":"User","site_admin":false},"repo":{"id":148825373,"node_id":"MDEwOlJlcG9zaXRvcnkxNDg4MjUzNzM=","name":"codecore_homework","full_name":"orsolyabus/codecore_homework","private":false,"owner":{"login":"orsolyabus","id":23640710,"node_id":"MDQ6VXNlcjIzNjQwNzEw","avatar_url":"https://avatars2.githubusercontent.com/u/23640710?v=4","gravatar_id":"","url":"https://api.github.com/users/orsolyabus","html_url":"https://github.com/orsolyabus","followers_url":"https://api.github.com/users/orsolyabus/followers","following_url":"https://api.github.com/users/orsolyabus/following{/other_user}","gists_url":"https://api.github.com/users/orsolyabus/gists{/gist_id}","starred_url":"https://api.github.com/users/orsolyabus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orsolyabus/subscriptions","organizations_url":"https://api.github.com/users/orsolyabus/orgs","repos_url":"https://api.github.com/users/orsolyabus/repos","events_url":"https://api.github.com/users/orsolyabus/events{/privacy}","received_events_url":"https://api.github.com/users/orsolyabus/received_events","type":"User","site_admin":false},"html_url":"https://github.com/orsolyabus/codecore_homework","description":null,"fork":false,"url":"https://api.github.com/repos/orsolyabus/codecore_homework","forks_url":"https://api.github.com/repos/orsolyabus/codecore_homework/forks","keys_url":"https://api.github.com/repos/orsolyabus/codecore_homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/orsolyabus/codecore_homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/orsolyabus/codecore_homework/teams","hooks_url":"https://api.github.com/repos/orsolyabus/codecore_homework/hooks","issue_events_url":"https://api.github.com/repos/orsolyabus/codecore_homework/issues/events{/number}","events_url":"https://api.github.com/repos/orsolyabus/codecore_homework/events","assignees_url":"https://api.github.com/repos/orsolyabus/codecore_homework/assignees{/user}","branches_url":"https://api.github.com/repos/orsolyabus/codecore_homework/branches{/branch}","tags_url":"https://api.github.com/repos/orsolyabus/codecore_homework/tags","blobs_url":"https://api.github.com/repos/orsolyabus/codecore_homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/orsolyabus/codecore_homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/orsolyabus/codecore_homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/orsolyabus/codecore_homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/orsolyabus/codecore_homework/statuses/{sha}","languages_url":"https://api.github.com/repos/orsolyabus/codecore_homework/languages","stargazers_url":"https://api.github.com/repos/orsolyabus/codecore_homework/stargazers","contributors_url":"https://api.github.com/repos/orsolyabus/codecore_homework/contributors","subscribers_url":"https://api.github.com/repos/orsolyabus/codecore_homework/subscribers","subscription_url":"https://api.github.com/repos/orsolyabus/codecore_homework/subscription","commits_url":"https://api.github.com/repos/orsolyabus/codecore_homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/orsolyabus/codecore_homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/orsolyabus/codecore_homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/orsolyabus/codecore_homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/orsolyabus/codecore_homework/contents/{+path}","compare_url":"https://api.github.com/repos/orsolyabus/codecore_homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/orsolyabus/codecore_homework/merges","archive_url":"https://api.github.com/repos/orsolyabus/codecore_homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/orsolyabus/codecore_homework/downloads","issues_url":"https://api.github.com/repos/orsolyabus/codecore_homework/issues{/number}","pulls_url":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls{/number}","milestones_url":"https://api.github.com/repos/orsolyabus/codecore_homework/milestones{/number}","notifications_url":"https://api.github.com/repos/orsolyabus/codecore_homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/orsolyabus/codecore_homework/labels{/name}","releases_url":"https://api.github.com/repos/orsolyabus/codecore_homework/releases{/id}","deployments_url":"https://api.github.com/repos/orsolyabus/codecore_homework/deployments","created_at":"2018-09-14T18:10:23Z","updated_at":"2018-10-13T01:26:40Z","pushed_at":"2018-10-18T16:29:28Z","git_url":"git://github.com/orsolyabus/codecore_homework.git","ssh_url":"git@github.com:orsolyabus/codecore_homework.git","clone_url":"https://github.com/orsolyabus/codecore_homework.git","svn_url":"https://github.com/orsolyabus/codecore_homework","homepage":null,"size":2335,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"orsolyabus:master","ref":"master","sha":"ae0b53764059f0257f36eb33398a9a054b2cb6e8","user":{"login":"orsolyabus","id":23640710,"node_id":"MDQ6VXNlcjIzNjQwNzEw","avatar_url":"https://avatars2.githubusercontent.com/u/23640710?v=4","gravatar_id":"","url":"https://api.github.com/users/orsolyabus","html_url":"https://github.com/orsolyabus","followers_url":"https://api.github.com/users/orsolyabus/followers","following_url":"https://api.github.com/users/orsolyabus/following{/other_user}","gists_url":"https://api.github.com/users/orsolyabus/gists{/gist_id}","starred_url":"https://api.github.com/users/orsolyabus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orsolyabus/subscriptions","organizations_url":"https://api.github.com/users/orsolyabus/orgs","repos_url":"https://api.github.com/users/orsolyabus/repos","events_url":"https://api.github.com/users/orsolyabus/events{/privacy}","received_events_url":"https://api.github.com/users/orsolyabus/received_events","type":"User","site_admin":false},"repo":{"id":148825373,"node_id":"MDEwOlJlcG9zaXRvcnkxNDg4MjUzNzM=","name":"codecore_homework","full_name":"orsolyabus/codecore_homework","private":false,"owner":{"login":"orsolyabus","id":23640710,"node_id":"MDQ6VXNlcjIzNjQwNzEw","avatar_url":"https://avatars2.githubusercontent.com/u/23640710?v=4","gravatar_id":"","url":"https://api.github.com/users/orsolyabus","html_url":"https://github.com/orsolyabus","followers_url":"https://api.github.com/users/orsolyabus/followers","following_url":"https://api.github.com/users/orsolyabus/following{/other_user}","gists_url":"https://api.github.com/users/orsolyabus/gists{/gist_id}","starred_url":"https://api.github.com/users/orsolyabus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orsolyabus/subscriptions","organizations_url":"https://api.github.com/users/orsolyabus/orgs","repos_url":"https://api.github.com/users/orsolyabus/repos","events_url":"https://api.github.com/users/orsolyabus/events{/privacy}","received_events_url":"https://api.github.com/users/orsolyabus/received_events","type":"User","site_admin":false},"html_url":"https://github.com/orsolyabus/codecore_homework","description":null,"fork":false,"url":"https://api.github.com/repos/orsolyabus/codecore_homework","forks_url":"https://api.github.com/repos/orsolyabus/codecore_homework/forks","keys_url":"https://api.github.com/repos/orsolyabus/codecore_homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/orsolyabus/codecore_homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/orsolyabus/codecore_homework/teams","hooks_url":"https://api.github.com/repos/orsolyabus/codecore_homework/hooks","issue_events_url":"https://api.github.com/repos/orsolyabus/codecore_homework/issues/events{/number}","events_url":"https://api.github.com/repos/orsolyabus/codecore_homework/events","assignees_url":"https://api.github.com/repos/orsolyabus/codecore_homework/assignees{/user}","branches_url":"https://api.github.com/repos/orsolyabus/codecore_homework/branches{/branch}","tags_url":"https://api.github.com/repos/orsolyabus/codecore_homework/tags","blobs_url":"https://api.github.com/repos/orsolyabus/codecore_homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/orsolyabus/codecore_homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/orsolyabus/codecore_homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/orsolyabus/codecore_homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/orsolyabus/codecore_homework/statuses/{sha}","languages_url":"https://api.github.com/repos/orsolyabus/codecore_homework/languages","stargazers_url":"https://api.github.com/repos/orsolyabus/codecore_homework/stargazers","contributors_url":"https://api.github.com/repos/orsolyabus/codecore_homework/contributors","subscribers_url":"https://api.github.com/repos/orsolyabus/codecore_homework/subscribers","subscription_url":"https://api.github.com/repos/orsolyabus/codecore_homework/subscription","commits_url":"https://api.github.com/repos/orsolyabus/codecore_homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/orsolyabus/codecore_homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/orsolyabus/codecore_homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/orsolyabus/codecore_homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/orsolyabus/codecore_homework/contents/{+path}","compare_url":"https://api.github.com/repos/orsolyabus/codecore_homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/orsolyabus/codecore_homework/merges","archive_url":"https://api.github.com/repos/orsolyabus/codecore_homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/orsolyabus/codecore_homework/downloads","issues_url":"https://api.github.com/repos/orsolyabus/codecore_homework/issues{/number}","pulls_url":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls{/number}","milestones_url":"https://api.github.com/repos/orsolyabus/codecore_homework/milestones{/number}","notifications_url":"https://api.github.com/repos/orsolyabus/codecore_homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/orsolyabus/codecore_homework/labels{/name}","releases_url":"https://api.github.com/repos/orsolyabus/codecore_homework/releases{/id}","deployments_url":"https://api.github.com/repos/orsolyabus/codecore_homework/deployments","created_at":"2018-09-14T18:10:23Z","updated_at":"2018-10-13T01:26:40Z","pushed_at":"2018-10-18T16:29:28Z","git_url":"git://github.com/orsolyabus/codecore_homework.git","ssh_url":"git@github.com:orsolyabus/codecore_homework.git","clone_url":"https://github.com/orsolyabus/codecore_homework.git","svn_url":"https://github.com/orsolyabus/codecore_homework","homepage":null,"size":2335,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/4"},"html":{"href":"https://github.com/orsolyabus/codecore_homework/pull/4"},"issue":{"href":"https://api.github.com/repos/orsolyabus/codecore_homework/issues/4"},"comments":{"href":"https://api.github.com/repos/orsolyabus/codecore_homework/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/orsolyabus/codecore_homework/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/orsolyabus/codecore_homework/statuses/eca5652e7b887927e2c7dda475699aac762d02ca"}},"author_association":"OWNER"}}
{"actor":{"display_login":"tylersuzukinelson"}}