{"action":"created","comment":{"url":"https://api.github.com/repos/18F/C2/pulls/comments/22421945","id":22421945,"diff_hunk":"@@ -7,4 +8,19 @@ def show\n     @show_comments = true\n   end\n \n+  def index\n+    @role = 'requester'\n+    my_carts = Cart.joins(:approvals).where(:approvals => {:role => @role, :user_id => @current_user[:id]})\n+    if my_carts.empty?\n+      @role = 'approver'\n+      my_carts = Cart.joins(:approvals).where(:approvals => {:role => @role, :user_id => @current_user[:id]})\n+    end","path":"app/controllers/carts_controller.rb","position":null,"original_position":17,"commit_id":"1c47b19aab3fca432b3f49a212c5305773cf1f2e","original_commit_id":"6d512c4ef16b8a9e80b1e0af4b043a7f1237aa56","user":{"login":"afeld","id":86842,"avatar_url":"https://avatars.githubusercontent.com/u/86842?v=3","gravatar_id":"","url":"https://api.github.com/users/afeld","html_url":"https://github.com/afeld","followers_url":"https://api.github.com/users/afeld/followers","following_url":"https://api.github.com/users/afeld/following{/other_user}","gists_url":"https://api.github.com/users/afeld/gists{/gist_id}","starred_url":"https://api.github.com/users/afeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afeld/subscriptions","organizations_url":"https://api.github.com/users/afeld/orgs","repos_url":"https://api.github.com/users/afeld/repos","events_url":"https://api.github.com/users/afeld/events{/privacy}","received_events_url":"https://api.github.com/users/afeld/received_events","type":"User","site_admin":false},"body":"Ohhh I see the issue.. the `@role` wouldn't be set. I think the logic makes more sense on a cart-by-cart basis:\r\n\r\n```\r\nfor each cart\r\n  show the cart summary\r\n  if user is an approver on the cart\r\n    show action buttons\r\n```\r\n\r\nrather than one role for the overall page. If you agree, feel free to add an inline `TODO` and we can worry about it later. Otherwise, no worries.","created_at":"2015-01-02T20:34:09Z","updated_at":"2015-01-02T20:34:09Z","html_url":"https://github.com/18F/C2/pull/131#discussion_r22421945","pull_request_url":"https://api.github.com/repos/18F/C2/pulls/131","_links":{"self":{"href":"https://api.github.com/repos/18F/C2/pulls/comments/22421945"},"html":{"href":"https://github.com/18F/C2/pull/131#discussion_r22421945"},"pull_request":{"href":"https://api.github.com/repos/18F/C2/pulls/131"}}},"pull_request":{"url":"https://api.github.com/repos/18F/C2/pulls/131","id":26263601,"html_url":"https://github.com/18F/C2/pull/131","diff_url":"https://github.com/18F/C2/pull/131.diff","patch_url":"https://github.com/18F/C2/pull/131.patch","issue_url":"https://api.github.com/repos/18F/C2/issues/131","number":131,"state":"open","locked":false,"title":"81308238 portal page","user":{"login":"sashax","id":1319679,"avatar_url":"https://avatars.githubusercontent.com/u/1319679?v=3","gravatar_id":"","url":"https://api.github.com/users/sashax","html_url":"https://github.com/sashax","followers_url":"https://api.github.com/users/sashax/followers","following_url":"https://api.github.com/users/sashax/following{/other_user}","gists_url":"https://api.github.com/users/sashax/gists{/gist_id}","starred_url":"https://api.github.com/users/sashax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sashax/subscriptions","organizations_url":"https://api.github.com/users/sashax/orgs","repos_url":"https://api.github.com/users/sashax/repos","events_url":"https://api.github.com/users/sashax/events{/privacy}","received_events_url":"https://api.github.com/users/sashax/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-12-17T22:46:55Z","updated_at":"2015-01-02T20:34:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68f1e047f60dcf686b973a65d37fe84bdd4cd648","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/18F/C2/pulls/131/commits","review_comments_url":"https://api.github.com/repos/18F/C2/pulls/131/comments","review_comment_url":"https://api.github.com/repos/18F/C2/pulls/comments/{number}","comments_url":"https://api.github.com/repos/18F/C2/issues/131/comments","statuses_url":"https://api.github.com/repos/18F/C2/statuses/1c47b19aab3fca432b3f49a212c5305773cf1f2e","head":{"label":"18F:81308238_portal_page","ref":"81308238_portal_page","sha":"1c47b19aab3fca432b3f49a212c5305773cf1f2e","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":18201810,"name":"C2","full_name":"18F/C2","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/C2","description":"Empowering P-Card holders and GSA Advantage users to purchase as efficiently and effectively as possible.","fork":false,"url":"https://api.github.com/repos/18F/C2","forks_url":"https://api.github.com/repos/18F/C2/forks","keys_url":"https://api.github.com/repos/18F/C2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/C2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/C2/teams","hooks_url":"https://api.github.com/repos/18F/C2/hooks","issue_events_url":"https://api.github.com/repos/18F/C2/issues/events{/number}","events_url":"https://api.github.com/repos/18F/C2/events","assignees_url":"https://api.github.com/repos/18F/C2/assignees{/user}","branches_url":"https://api.github.com/repos/18F/C2/branches{/branch}","tags_url":"https://api.github.com/repos/18F/C2/tags","blobs_url":"https://api.github.com/repos/18F/C2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/C2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/C2/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/C2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/C2/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/C2/languages","stargazers_url":"https://api.github.com/repos/18F/C2/stargazers","contributors_url":"https://api.github.com/repos/18F/C2/contributors","subscribers_url":"https://api.github.com/repos/18F/C2/subscribers","subscription_url":"https://api.github.com/repos/18F/C2/subscription","commits_url":"https://api.github.com/repos/18F/C2/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/C2/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/C2/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/C2/issues/comments/{number}","contents_url":"https://api.github.com/repos/18F/C2/contents/{+path}","compare_url":"https://api.github.com/repos/18F/C2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/C2/merges","archive_url":"https://api.github.com/repos/18F/C2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/C2/downloads","issues_url":"https://api.github.com/repos/18F/C2/issues{/number}","pulls_url":"https://api.github.com/repos/18F/C2/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/C2/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/C2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/C2/labels{/name}","releases_url":"https://api.github.com/repos/18F/C2/releases{/id}","created_at":"2014-03-28T05:15:23Z","updated_at":"2014-12-31T21:54:28Z","pushed_at":"2015-01-02T20:30:52Z","git_url":"git://github.com/18F/C2.git","ssh_url":"git@github.com:18F/C2.git","clone_url":"https://github.com/18F/C2.git","svn_url":"https://github.com/18F/C2","homepage":"https://18f.github.io/C2/","size":78682,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":7,"forks":4,"open_issues":7,"watchers":5,"default_branch":"master"}},"base":{"label":"18F:master","ref":"master","sha":"72b1b667d08b6609ee3b41465e9cb49292da0f56","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":18201810,"name":"C2","full_name":"18F/C2","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/C2","description":"Empowering P-Card holders and GSA Advantage users to purchase as efficiently and effectively as possible.","fork":false,"url":"https://api.github.com/repos/18F/C2","forks_url":"https://api.github.com/repos/18F/C2/forks","keys_url":"https://api.github.com/repos/18F/C2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/C2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/C2/teams","hooks_url":"https://api.github.com/repos/18F/C2/hooks","issue_events_url":"https://api.github.com/repos/18F/C2/issues/events{/number}","events_url":"https://api.github.com/repos/18F/C2/events","assignees_url":"https://api.github.com/repos/18F/C2/assignees{/user}","branches_url":"https://api.github.com/repos/18F/C2/branches{/branch}","tags_url":"https://api.github.com/repos/18F/C2/tags","blobs_url":"https://api.github.com/repos/18F/C2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/C2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/C2/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/C2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/C2/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/C2/languages","stargazers_url":"https://api.github.com/repos/18F/C2/stargazers","contributors_url":"https://api.github.com/repos/18F/C2/contributors","subscribers_url":"https://api.github.com/repos/18F/C2/subscribers","subscription_url":"https://api.github.com/repos/18F/C2/subscription","commits_url":"https://api.github.com/repos/18F/C2/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/C2/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/C2/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/C2/issues/comments/{number}","contents_url":"https://api.github.com/repos/18F/C2/contents/{+path}","compare_url":"https://api.github.com/repos/18F/C2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/C2/merges","archive_url":"https://api.github.com/repos/18F/C2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/C2/downloads","issues_url":"https://api.github.com/repos/18F/C2/issues{/number}","pulls_url":"https://api.github.com/repos/18F/C2/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/C2/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/C2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/C2/labels{/name}","releases_url":"https://api.github.com/repos/18F/C2/releases{/id}","created_at":"2014-03-28T05:15:23Z","updated_at":"2014-12-31T21:54:28Z","pushed_at":"2015-01-02T20:30:52Z","git_url":"git://github.com/18F/C2.git","ssh_url":"git@github.com:18F/C2.git","clone_url":"https://github.com/18F/C2.git","svn_url":"https://github.com/18F/C2","homepage":"https://18f.github.io/C2/","size":78682,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":7,"forks":4,"open_issues":7,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/18F/C2/pulls/131"},"html":{"href":"https://github.com/18F/C2/pull/131"},"issue":{"href":"https://api.github.com/repos/18F/C2/issues/131"},"comments":{"href":"https://api.github.com/repos/18F/C2/issues/131/comments"},"review_comments":{"href":"https://api.github.com/repos/18F/C2/pulls/131/comments"},"review_comment":{"href":"https://api.github.com/repos/18F/C2/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/18F/C2/pulls/131/commits"},"statuses":{"href":"https://api.github.com/repos/18F/C2/statuses/1c47b19aab3fca432b3f49a212c5305773cf1f2e"}}}}