{"action":"created","comment":{"url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/comments/69286917","id":69286917,"diff_hunk":"@@ -0,0 +1,50 @@\n+class Admin::ConfirmCartsController < AdminController\n+  before_action :require_manager\n+\n+  def index\n+    params[:status] ||= AdminCart::STATUS[:shipping]\n+    @carts = AdminCart.status(params[:status]).recent.paginate(page: params[:page])\n+  end\n+\n+  def confirm\n+    shipping_cart = AdminCart.status(AdminCart::STATUS[:shipping]).find(params[:id])\n+    cart_items = shipping_cart.admin_cart_items\n+\n+    set_cart_items_to_stock(cart_items)\n+\n+    shipping_cart.update_attribute(:status, AdminCart::STATUS[:stock])\n+\n+    redirect_to admin_confirm_carts_path(status: AdminCart::STATUS[:stock])\n+  end\n+\n+  private\n+\n+  def set_cart_items_to_stock(cart_items)\n+    cart_items.each do |cart_item|\n+      save_stock_and_stock_spec(cart_item)\n+    end\n+  end\n+\n+  def save_stock_and_stock_spec(cart_item)\n+    stock = Stock.find_or_initialize_by(item_id: cart_item.item_id)\n+    stock_spec = StockSpec.find_or_initialize_by(item_spec_id: cart_item.item_spec_id)\n+\n+    if stock.new_record? && stock_spec.new_record?\n+      stock.item = cart_item.item","path":"app/controllers/admin/confirm_carts_controller.rb","position":33,"original_position":33,"commit_id":"94704e2b83c20d22b1cda49a109fc73d526e9fb9","original_commit_id":"94704e2b83c20d22b1cda49a109fc73d526e9fb9","user":{"login":"varbark","id":13852334,"avatar_url":"https://avatars.githubusercontent.com/u/13852334?v=3","gravatar_id":"","url":"https://api.github.com/users/varbark","html_url":"https://github.com/varbark","followers_url":"https://api.github.com/users/varbark/followers","following_url":"https://api.github.com/users/varbark/following{/other_user}","gists_url":"https://api.github.com/users/varbark/gists{/gist_id}","starred_url":"https://api.github.com/users/varbark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varbark/subscriptions","organizations_url":"https://api.github.com/users/varbark/orgs","repos_url":"https://api.github.com/users/varbark/repos","events_url":"https://api.github.com/users/varbark/events{/privacy}","received_events_url":"https://api.github.com/users/varbark/received_events","type":"User","site_admin":false},"body":"already set this value before\r\n","created_at":"2016-07-01T11:39:37Z","updated_at":"2016-07-01T11:39:37Z","html_url":"https://github.com/kosbrother/mongmongwoo/pull/109#discussion_r69286917","pull_request_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/109","_links":{"self":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/comments/69286917"},"html":{"href":"https://github.com/kosbrother/mongmongwoo/pull/109#discussion_r69286917"},"pull_request":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/109"}}},"pull_request":{"url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/109","id":75773965,"html_url":"https://github.com/kosbrother/mongmongwoo/pull/109","diff_url":"https://github.com/kosbrother/mongmongwoo/pull/109.diff","patch_url":"https://github.com/kosbrother/mongmongwoo/pull/109.patch","issue_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/109","number":109,"state":"open","locked":false,"title":"Confirm admin cart items","user":{"login":"gvszg","id":7985560,"avatar_url":"https://avatars.githubusercontent.com/u/7985560?v=3","gravatar_id":"","url":"https://api.github.com/users/gvszg","html_url":"https://github.com/gvszg","followers_url":"https://api.github.com/users/gvszg/followers","following_url":"https://api.github.com/users/gvszg/following{/other_user}","gists_url":"https://api.github.com/users/gvszg/gists{/gist_id}","starred_url":"https://api.github.com/users/gvszg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvszg/subscriptions","organizations_url":"https://api.github.com/users/gvszg/orgs","repos_url":"https://api.github.com/users/gvszg/repos","events_url":"https://api.github.com/users/gvszg/events{/privacy}","received_events_url":"https://api.github.com/users/gvszg/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-30T07:47:02Z","updated_at":"2016-07-01T11:39:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f32d54000ba42ef8ec3a5a6a8a7deb13f84ee01a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/109/commits","review_comments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/109/comments","review_comment_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/109/comments","statuses_url":"https://api.github.com/repos/kosbrother/mongmongwoo/statuses/94704e2b83c20d22b1cda49a109fc73d526e9fb9","head":{"label":"kosbrother:confirm-admin-cart-item","ref":"confirm-admin-cart-item","sha":"94704e2b83c20d22b1cda49a109fc73d526e9fb9","user":{"login":"kosbrother","id":14856209,"avatar_url":"https://avatars.githubusercontent.com/u/14856209?v=3","gravatar_id":"","url":"https://api.github.com/users/kosbrother","html_url":"https://github.com/kosbrother","followers_url":"https://api.github.com/users/kosbrother/followers","following_url":"https://api.github.com/users/kosbrother/following{/other_user}","gists_url":"https://api.github.com/users/kosbrother/gists{/gist_id}","starred_url":"https://api.github.com/users/kosbrother/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosbrother/subscriptions","organizations_url":"https://api.github.com/users/kosbrother/orgs","repos_url":"https://api.github.com/users/kosbrother/repos","events_url":"https://api.github.com/users/kosbrother/events{/privacy}","received_events_url":"https://api.github.com/users/kosbrother/received_events","type":"Organization","site_admin":false},"repo":{"id":56124462,"name":"mongmongwoo","full_name":"kosbrother/mongmongwoo","owner":{"login":"kosbrother","id":14856209,"avatar_url":"https://avatars.githubusercontent.com/u/14856209?v=3","gravatar_id":"","url":"https://api.github.com/users/kosbrother","html_url":"https://github.com/kosbrother","followers_url":"https://api.github.com/users/kosbrother/followers","following_url":"https://api.github.com/users/kosbrother/following{/other_user}","gists_url":"https://api.github.com/users/kosbrother/gists{/gist_id}","starred_url":"https://api.github.com/users/kosbrother/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosbrother/subscriptions","organizations_url":"https://api.github.com/users/kosbrother/orgs","repos_url":"https://api.github.com/users/kosbrother/repos","events_url":"https://api.github.com/users/kosbrother/events{/privacy}","received_events_url":"https://api.github.com/users/kosbrother/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kosbrother/mongmongwoo","description":"","fork":false,"url":"https://api.github.com/repos/kosbrother/mongmongwoo","forks_url":"https://api.github.com/repos/kosbrother/mongmongwoo/forks","keys_url":"https://api.github.com/repos/kosbrother/mongmongwoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kosbrother/mongmongwoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kosbrother/mongmongwoo/teams","hooks_url":"https://api.github.com/repos/kosbrother/mongmongwoo/hooks","issue_events_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/events{/number}","events_url":"https://api.github.com/repos/kosbrother/mongmongwoo/events","assignees_url":"https://api.github.com/repos/kosbrother/mongmongwoo/assignees{/user}","branches_url":"https://api.github.com/repos/kosbrother/mongmongwoo/branches{/branch}","tags_url":"https://api.github.com/repos/kosbrother/mongmongwoo/tags","blobs_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kosbrother/mongmongwoo/statuses/{sha}","languages_url":"https://api.github.com/repos/kosbrother/mongmongwoo/languages","stargazers_url":"https://api.github.com/repos/kosbrother/mongmongwoo/stargazers","contributors_url":"https://api.github.com/repos/kosbrother/mongmongwoo/contributors","subscribers_url":"https://api.github.com/repos/kosbrother/mongmongwoo/subscribers","subscription_url":"https://api.github.com/repos/kosbrother/mongmongwoo/subscription","commits_url":"https://api.github.com/repos/kosbrother/mongmongwoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/comments{/number}","contents_url":"https://api.github.com/repos/kosbrother/mongmongwoo/contents/{+path}","compare_url":"https://api.github.com/repos/kosbrother/mongmongwoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kosbrother/mongmongwoo/merges","archive_url":"https://api.github.com/repos/kosbrother/mongmongwoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kosbrother/mongmongwoo/downloads","issues_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues{/number}","pulls_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls{/number}","milestones_url":"https://api.github.com/repos/kosbrother/mongmongwoo/milestones{/number}","notifications_url":"https://api.github.com/repos/kosbrother/mongmongwoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kosbrother/mongmongwoo/labels{/name}","releases_url":"https://api.github.com/repos/kosbrother/mongmongwoo/releases{/id}","deployments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/deployments","created_at":"2016-04-13T05:46:41Z","updated_at":"2016-04-13T05:47:43Z","pushed_at":"2016-07-01T10:59:25Z","git_url":"git://github.com/kosbrother/mongmongwoo.git","ssh_url":"git@github.com:kosbrother/mongmongwoo.git","clone_url":"https://github.com/kosbrother/mongmongwoo.git","svn_url":"https://github.com/kosbrother/mongmongwoo","homepage":null,"size":4852,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"kosbrother:stock","ref":"stock","sha":"03fa0fa446946a59bf6b4882d077611bb1ef14c4","user":{"login":"kosbrother","id":14856209,"avatar_url":"https://avatars.githubusercontent.com/u/14856209?v=3","gravatar_id":"","url":"https://api.github.com/users/kosbrother","html_url":"https://github.com/kosbrother","followers_url":"https://api.github.com/users/kosbrother/followers","following_url":"https://api.github.com/users/kosbrother/following{/other_user}","gists_url":"https://api.github.com/users/kosbrother/gists{/gist_id}","starred_url":"https://api.github.com/users/kosbrother/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosbrother/subscriptions","organizations_url":"https://api.github.com/users/kosbrother/orgs","repos_url":"https://api.github.com/users/kosbrother/repos","events_url":"https://api.github.com/users/kosbrother/events{/privacy}","received_events_url":"https://api.github.com/users/kosbrother/received_events","type":"Organization","site_admin":false},"repo":{"id":56124462,"name":"mongmongwoo","full_name":"kosbrother/mongmongwoo","owner":{"login":"kosbrother","id":14856209,"avatar_url":"https://avatars.githubusercontent.com/u/14856209?v=3","gravatar_id":"","url":"https://api.github.com/users/kosbrother","html_url":"https://github.com/kosbrother","followers_url":"https://api.github.com/users/kosbrother/followers","following_url":"https://api.github.com/users/kosbrother/following{/other_user}","gists_url":"https://api.github.com/users/kosbrother/gists{/gist_id}","starred_url":"https://api.github.com/users/kosbrother/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosbrother/subscriptions","organizations_url":"https://api.github.com/users/kosbrother/orgs","repos_url":"https://api.github.com/users/kosbrother/repos","events_url":"https://api.github.com/users/kosbrother/events{/privacy}","received_events_url":"https://api.github.com/users/kosbrother/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kosbrother/mongmongwoo","description":"","fork":false,"url":"https://api.github.com/repos/kosbrother/mongmongwoo","forks_url":"https://api.github.com/repos/kosbrother/mongmongwoo/forks","keys_url":"https://api.github.com/repos/kosbrother/mongmongwoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kosbrother/mongmongwoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kosbrother/mongmongwoo/teams","hooks_url":"https://api.github.com/repos/kosbrother/mongmongwoo/hooks","issue_events_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/events{/number}","events_url":"https://api.github.com/repos/kosbrother/mongmongwoo/events","assignees_url":"https://api.github.com/repos/kosbrother/mongmongwoo/assignees{/user}","branches_url":"https://api.github.com/repos/kosbrother/mongmongwoo/branches{/branch}","tags_url":"https://api.github.com/repos/kosbrother/mongmongwoo/tags","blobs_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kosbrother/mongmongwoo/statuses/{sha}","languages_url":"https://api.github.com/repos/kosbrother/mongmongwoo/languages","stargazers_url":"https://api.github.com/repos/kosbrother/mongmongwoo/stargazers","contributors_url":"https://api.github.com/repos/kosbrother/mongmongwoo/contributors","subscribers_url":"https://api.github.com/repos/kosbrother/mongmongwoo/subscribers","subscription_url":"https://api.github.com/repos/kosbrother/mongmongwoo/subscription","commits_url":"https://api.github.com/repos/kosbrother/mongmongwoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/comments{/number}","contents_url":"https://api.github.com/repos/kosbrother/mongmongwoo/contents/{+path}","compare_url":"https://api.github.com/repos/kosbrother/mongmongwoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kosbrother/mongmongwoo/merges","archive_url":"https://api.github.com/repos/kosbrother/mongmongwoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kosbrother/mongmongwoo/downloads","issues_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues{/number}","pulls_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls{/number}","milestones_url":"https://api.github.com/repos/kosbrother/mongmongwoo/milestones{/number}","notifications_url":"https://api.github.com/repos/kosbrother/mongmongwoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kosbrother/mongmongwoo/labels{/name}","releases_url":"https://api.github.com/repos/kosbrother/mongmongwoo/releases{/id}","deployments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/deployments","created_at":"2016-04-13T05:46:41Z","updated_at":"2016-04-13T05:47:43Z","pushed_at":"2016-07-01T10:59:25Z","git_url":"git://github.com/kosbrother/mongmongwoo.git","ssh_url":"git@github.com:kosbrother/mongmongwoo.git","clone_url":"https://github.com/kosbrother/mongmongwoo.git","svn_url":"https://github.com/kosbrother/mongmongwoo","homepage":null,"size":4852,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/109"},"html":{"href":"https://github.com/kosbrother/mongmongwoo/pull/109"},"issue":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/109"},"comments":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/109/comments"},"review_comments":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/109/comments"},"review_comment":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/109/commits"},"statuses":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/statuses/94704e2b83c20d22b1cda49a109fc73d526e9fb9"}}}}
{"actor":{"display_login":"varbark"}}