{"action":"created","comment":{"url":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/comments/108185950","pull_request_review_id":29201645,"id":108185950,"diff_hunk":"@@ -29,30 +29,37 @@ defmodule Pairmotron.PairController do\n     |> render_index(year, week, groups_and_pairs)\n   end\n \n-  @spec render_index(Plug.Conn.t, integer(), 1..53, [{Types.group, Types.pair}]) :: Plug.Conn.t\n+  @spec render_index(Plug.Conn.t, integer(), 1..53, [{Types.group, [{Types.pair, Types.retro | nil}]}]) :: Plug.Conn.t\n   defp render_index(conn, year, week, groups_and_pairs) do\n     render(conn, \"index.html\", year: year, week: week, groups_and_pairs: groups_and_pairs,\n               start_date: Timex.from_iso_triplet({year, week, 1}),\n               stop_date: Timex.from_iso_triplet({year, week, 7}))\n   end\n \n-  @spec fetch_groups_and_pairs(Types.user, integer(), 1..53) :: {[{Types.group, Types.pair}], [String.t]}\n+  @spec fetch_groups_and_pairs(Types.user, integer(), 1..53) :: {[{Types.group, [{Types.pair, Types.retro | nil}]}], [String.t]}\n   defp fetch_groups_and_pairs(user, year, week) do\n     user = user |> Repo.preload(:groups)\n-    {pairs, messages} = pairs_for_user_groups(user, year, week)\n-    {Enum.zip(user.groups, pairs), messages}\n+    groups_with_pairs_for_user(user, year, week)\n   end\n \n-  @spec pairs_for_user_groups(Types.user, integer(), 1..53) :: {[Types.pair], [String.t]}\n-  defp pairs_for_user_groups(user, year, week) do\n+  @spec groups_with_pairs_for_user(Types.user, integer(), 1..53) :: {[{Types.group, [{Types.pair, Types.retro | nil}]}], [String.t]}","path":"web/controllers/pair_controller.ex","position":23,"original_position":23,"commit_id":"478a98cba96e3e88ca182c1b0ab258fa68a65407","original_commit_id":"f04431cac0b6e50c6c9889f525082dd0aa13d254","user":{"login":"mbramson","id":6462927,"avatar_url":"https://avatars2.githubusercontent.com/u/6462927?v=3","gravatar_id":"","url":"https://api.github.com/users/mbramson","html_url":"https://github.com/mbramson","followers_url":"https://api.github.com/users/mbramson/followers","following_url":"https://api.github.com/users/mbramson/following{/other_user}","gists_url":"https://api.github.com/users/mbramson/gists{/gist_id}","starred_url":"https://api.github.com/users/mbramson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbramson/subscriptions","organizations_url":"https://api.github.com/users/mbramson/orgs","repos_url":"https://api.github.com/users/mbramson/repos","events_url":"https://api.github.com/users/mbramson/events{/privacy}","received_events_url":"https://api.github.com/users/mbramson/received_events","type":"User","site_admin":false},"body":"That would definitely make this easier to reason about.","created_at":"2017-03-27T14:37:21Z","updated_at":"2017-03-27T14:37:21Z","html_url":"https://github.com/ElixirCLE/pairmotron/pull/147#discussion_r108185950","pull_request_url":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/147","_links":{"self":{"href":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/comments/108185950"},"html":{"href":"https://github.com/ElixirCLE/pairmotron/pull/147#discussion_r108185950"},"pull_request":{"href":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/147"}}},"pull_request":{"url":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/147","id":112171219,"html_url":"https://github.com/ElixirCLE/pairmotron/pull/147","diff_url":"https://github.com/ElixirCLE/pairmotron/pull/147.diff","patch_url":"https://github.com/ElixirCLE/pairmotron/pull/147.patch","issue_url":"https://api.github.com/repos/ElixirCLE/pairmotron/issues/147","number":147,"state":"open","locked":false,"title":"Add create retro and edit retro links to /pairs","user":{"login":"mbramson","id":6462927,"avatar_url":"https://avatars2.githubusercontent.com/u/6462927?v=3","gravatar_id":"","url":"https://api.github.com/users/mbramson","html_url":"https://github.com/mbramson","followers_url":"https://api.github.com/users/mbramson/followers","following_url":"https://api.github.com/users/mbramson/following{/other_user}","gists_url":"https://api.github.com/users/mbramson/gists{/gist_id}","starred_url":"https://api.github.com/users/mbramson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbramson/subscriptions","organizations_url":"https://api.github.com/users/mbramson/orgs","repos_url":"https://api.github.com/users/mbramson/repos","events_url":"https://api.github.com/users/mbramson/events{/privacy}","received_events_url":"https://api.github.com/users/mbramson/received_events","type":"User","site_admin":false},"body":"Added back the create retro and edit retro links to /pairs as they were removed because of a bug when group-based pairing was added.\r\n\r\nPreviously, the query that retrieved retros simply looked for a retro (and unfortunately multiple) that was associated with the user and the year and week (through a pair). This worked fine when it was only possible for a user to be in one pair per week, but it broke down once a user could be in many pairs in the same week due to being in multiple groups. The end effect was if you were paired in Group A and Group B, and created a retrospective for Group A, the \"create retro\" link would change to \"edit retro\" for both Group A and Group B, and would link to the retro that you created for Group A under both links. This now works properly.\r\n\r\nThis also fixed a subtle bug due to zipping the user's groups with the user's pairs for a given week when a user wasn't in a pair for all of their groups that week. If that pair that they weren't in was not the last group in the list of groups (order was arbitrary), then the pairs could shift to a different group. Pairs are now connected to groups explicitly, so it is possible for the second group out of three to not have a pair for the current user and have it display properly.\r\n\r\nAlthough not a possible case presently, the /pairs route will now properly display multiple pairs for a group if the user is in multiple pairs.\r\n\r\nCloses #126","created_at":"2017-03-23T06:36:45Z","updated_at":"2017-03-27T14:37:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"227320641afbec424d3d492b55ff5f7a067d2ceb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/147/commits","review_comments_url":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/147/comments","review_comment_url":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ElixirCLE/pairmotron/issues/147/comments","statuses_url":"https://api.github.com/repos/ElixirCLE/pairmotron/statuses/478a98cba96e3e88ca182c1b0ab258fa68a65407","head":{"label":"ElixirCLE:126-add-retro-links-to-pairs","ref":"126-add-retro-links-to-pairs","sha":"478a98cba96e3e88ca182c1b0ab258fa68a65407","user":{"login":"ElixirCLE","id":17600691,"avatar_url":"https://avatars2.githubusercontent.com/u/17600691?v=3","gravatar_id":"","url":"https://api.github.com/users/ElixirCLE","html_url":"https://github.com/ElixirCLE","followers_url":"https://api.github.com/users/ElixirCLE/followers","following_url":"https://api.github.com/users/ElixirCLE/following{/other_user}","gists_url":"https://api.github.com/users/ElixirCLE/gists{/gist_id}","starred_url":"https://api.github.com/users/ElixirCLE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElixirCLE/subscriptions","organizations_url":"https://api.github.com/users/ElixirCLE/orgs","repos_url":"https://api.github.com/users/ElixirCLE/repos","events_url":"https://api.github.com/users/ElixirCLE/events{/privacy}","received_events_url":"https://api.github.com/users/ElixirCLE/received_events","type":"Organization","site_admin":false},"repo":{"id":72885199,"name":"pairmotron","full_name":"ElixirCLE/pairmotron","owner":{"login":"ElixirCLE","id":17600691,"avatar_url":"https://avatars2.githubusercontent.com/u/17600691?v=3","gravatar_id":"","url":"https://api.github.com/users/ElixirCLE","html_url":"https://github.com/ElixirCLE","followers_url":"https://api.github.com/users/ElixirCLE/followers","following_url":"https://api.github.com/users/ElixirCLE/following{/other_user}","gists_url":"https://api.github.com/users/ElixirCLE/gists{/gist_id}","starred_url":"https://api.github.com/users/ElixirCLE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElixirCLE/subscriptions","organizations_url":"https://api.github.com/users/ElixirCLE/orgs","repos_url":"https://api.github.com/users/ElixirCLE/repos","events_url":"https://api.github.com/users/ElixirCLE/events{/privacy}","received_events_url":"https://api.github.com/users/ElixirCLE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ElixirCLE/pairmotron","description":"Programming Pair Pairifier","fork":false,"url":"https://api.github.com/repos/ElixirCLE/pairmotron","forks_url":"https://api.github.com/repos/ElixirCLE/pairmotron/forks","keys_url":"https://api.github.com/repos/ElixirCLE/pairmotron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ElixirCLE/pairmotron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ElixirCLE/pairmotron/teams","hooks_url":"https://api.github.com/repos/ElixirCLE/pairmotron/hooks","issue_events_url":"https://api.github.com/repos/ElixirCLE/pairmotron/issues/events{/number}","events_url":"https://api.github.com/repos/ElixirCLE/pairmotron/events","assignees_url":"https://api.github.com/repos/ElixirCLE/pairmotron/assignees{/user}","branches_url":"https://api.github.com/repos/ElixirCLE/pairmotron/branches{/branch}","tags_url":"https://api.github.com/repos/ElixirCLE/pairmotron/tags","blobs_url":"https://api.github.com/repos/ElixirCLE/pairmotron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ElixirCLE/pairmotron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ElixirCLE/pairmotron/git/refs{/sha}","trees_url":"https://api.github.com/repos/ElixirCLE/pairmotron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ElixirCLE/pairmotron/statuses/{sha}","languages_url":"https://api.github.com/repos/ElixirCLE/pairmotron/languages","stargazers_url":"https://api.github.com/repos/ElixirCLE/pairmotron/stargazers","contributors_url":"https://api.github.com/repos/ElixirCLE/pairmotron/contributors","subscribers_url":"https://api.github.com/repos/ElixirCLE/pairmotron/subscribers","subscription_url":"https://api.github.com/repos/ElixirCLE/pairmotron/subscription","commits_url":"https://api.github.com/repos/ElixirCLE/pairmotron/commits{/sha}","git_commits_url":"https://api.github.com/repos/ElixirCLE/pairmotron/git/commits{/sha}","comments_url":"https://api.github.com/repos/ElixirCLE/pairmotron/comments{/number}","issue_comment_url":"https://api.github.com/repos/ElixirCLE/pairmotron/issues/comments{/number}","contents_url":"https://api.github.com/repos/ElixirCLE/pairmotron/contents/{+path}","compare_url":"https://api.github.com/repos/ElixirCLE/pairmotron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ElixirCLE/pairmotron/merges","archive_url":"https://api.github.com/repos/ElixirCLE/pairmotron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ElixirCLE/pairmotron/downloads","issues_url":"https://api.github.com/repos/ElixirCLE/pairmotron/issues{/number}","pulls_url":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls{/number}","milestones_url":"https://api.github.com/repos/ElixirCLE/pairmotron/milestones{/number}","notifications_url":"https://api.github.com/repos/ElixirCLE/pairmotron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ElixirCLE/pairmotron/labels{/name}","releases_url":"https://api.github.com/repos/ElixirCLE/pairmotron/releases{/id}","deployments_url":"https://api.github.com/repos/ElixirCLE/pairmotron/deployments","created_at":"2016-11-04T21:03:33Z","updated_at":"2017-03-02T01:21:46Z","pushed_at":"2017-03-27T14:11:01Z","git_url":"git://github.com/ElixirCLE/pairmotron.git","ssh_url":"git@github.com:ElixirCLE/pairmotron.git","clone_url":"https://github.com/ElixirCLE/pairmotron.git","svn_url":"https://github.com/ElixirCLE/pairmotron","homepage":"https://pairmotron.herokuapp.com","size":1736,"stargazers_count":3,"watchers_count":3,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":15,"forks":2,"open_issues":15,"watchers":3,"default_branch":"master"}},"base":{"label":"ElixirCLE:master","ref":"master","sha":"79fedfdda25395df692408df0574394589f4d2ce","user":{"login":"ElixirCLE","id":17600691,"avatar_url":"https://avatars2.githubusercontent.com/u/17600691?v=3","gravatar_id":"","url":"https://api.github.com/users/ElixirCLE","html_url":"https://github.com/ElixirCLE","followers_url":"https://api.github.com/users/ElixirCLE/followers","following_url":"https://api.github.com/users/ElixirCLE/following{/other_user}","gists_url":"https://api.github.com/users/ElixirCLE/gists{/gist_id}","starred_url":"https://api.github.com/users/ElixirCLE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElixirCLE/subscriptions","organizations_url":"https://api.github.com/users/ElixirCLE/orgs","repos_url":"https://api.github.com/users/ElixirCLE/repos","events_url":"https://api.github.com/users/ElixirCLE/events{/privacy}","received_events_url":"https://api.github.com/users/ElixirCLE/received_events","type":"Organization","site_admin":false},"repo":{"id":72885199,"name":"pairmotron","full_name":"ElixirCLE/pairmotron","owner":{"login":"ElixirCLE","id":17600691,"avatar_url":"https://avatars2.githubusercontent.com/u/17600691?v=3","gravatar_id":"","url":"https://api.github.com/users/ElixirCLE","html_url":"https://github.com/ElixirCLE","followers_url":"https://api.github.com/users/ElixirCLE/followers","following_url":"https://api.github.com/users/ElixirCLE/following{/other_user}","gists_url":"https://api.github.com/users/ElixirCLE/gists{/gist_id}","starred_url":"https://api.github.com/users/ElixirCLE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElixirCLE/subscriptions","organizations_url":"https://api.github.com/users/ElixirCLE/orgs","repos_url":"https://api.github.com/users/ElixirCLE/repos","events_url":"https://api.github.com/users/ElixirCLE/events{/privacy}","received_events_url":"https://api.github.com/users/ElixirCLE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ElixirCLE/pairmotron","description":"Programming Pair Pairifier","fork":false,"url":"https://api.github.com/repos/ElixirCLE/pairmotron","forks_url":"https://api.github.com/repos/ElixirCLE/pairmotron/forks","keys_url":"https://api.github.com/repos/ElixirCLE/pairmotron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ElixirCLE/pairmotron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ElixirCLE/pairmotron/teams","hooks_url":"https://api.github.com/repos/ElixirCLE/pairmotron/hooks","issue_events_url":"https://api.github.com/repos/ElixirCLE/pairmotron/issues/events{/number}","events_url":"https://api.github.com/repos/ElixirCLE/pairmotron/events","assignees_url":"https://api.github.com/repos/ElixirCLE/pairmotron/assignees{/user}","branches_url":"https://api.github.com/repos/ElixirCLE/pairmotron/branches{/branch}","tags_url":"https://api.github.com/repos/ElixirCLE/pairmotron/tags","blobs_url":"https://api.github.com/repos/ElixirCLE/pairmotron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ElixirCLE/pairmotron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ElixirCLE/pairmotron/git/refs{/sha}","trees_url":"https://api.github.com/repos/ElixirCLE/pairmotron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ElixirCLE/pairmotron/statuses/{sha}","languages_url":"https://api.github.com/repos/ElixirCLE/pairmotron/languages","stargazers_url":"https://api.github.com/repos/ElixirCLE/pairmotron/stargazers","contributors_url":"https://api.github.com/repos/ElixirCLE/pairmotron/contributors","subscribers_url":"https://api.github.com/repos/ElixirCLE/pairmotron/subscribers","subscription_url":"https://api.github.com/repos/ElixirCLE/pairmotron/subscription","commits_url":"https://api.github.com/repos/ElixirCLE/pairmotron/commits{/sha}","git_commits_url":"https://api.github.com/repos/ElixirCLE/pairmotron/git/commits{/sha}","comments_url":"https://api.github.com/repos/ElixirCLE/pairmotron/comments{/number}","issue_comment_url":"https://api.github.com/repos/ElixirCLE/pairmotron/issues/comments{/number}","contents_url":"https://api.github.com/repos/ElixirCLE/pairmotron/contents/{+path}","compare_url":"https://api.github.com/repos/ElixirCLE/pairmotron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ElixirCLE/pairmotron/merges","archive_url":"https://api.github.com/repos/ElixirCLE/pairmotron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ElixirCLE/pairmotron/downloads","issues_url":"https://api.github.com/repos/ElixirCLE/pairmotron/issues{/number}","pulls_url":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls{/number}","milestones_url":"https://api.github.com/repos/ElixirCLE/pairmotron/milestones{/number}","notifications_url":"https://api.github.com/repos/ElixirCLE/pairmotron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ElixirCLE/pairmotron/labels{/name}","releases_url":"https://api.github.com/repos/ElixirCLE/pairmotron/releases{/id}","deployments_url":"https://api.github.com/repos/ElixirCLE/pairmotron/deployments","created_at":"2016-11-04T21:03:33Z","updated_at":"2017-03-02T01:21:46Z","pushed_at":"2017-03-27T14:11:01Z","git_url":"git://github.com/ElixirCLE/pairmotron.git","ssh_url":"git@github.com:ElixirCLE/pairmotron.git","clone_url":"https://github.com/ElixirCLE/pairmotron.git","svn_url":"https://github.com/ElixirCLE/pairmotron","homepage":"https://pairmotron.herokuapp.com","size":1736,"stargazers_count":3,"watchers_count":3,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":15,"forks":2,"open_issues":15,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/147"},"html":{"href":"https://github.com/ElixirCLE/pairmotron/pull/147"},"issue":{"href":"https://api.github.com/repos/ElixirCLE/pairmotron/issues/147"},"comments":{"href":"https://api.github.com/repos/ElixirCLE/pairmotron/issues/147/comments"},"review_comments":{"href":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/147/comments"},"review_comment":{"href":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ElixirCLE/pairmotron/pulls/147/commits"},"statuses":{"href":"https://api.github.com/repos/ElixirCLE/pairmotron/statuses/478a98cba96e3e88ca182c1b0ab258fa68a65407"}}}}
{"actor":{"display_login":"mbramson"}}