{"action":"created","comment":{"url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/comments/56576035","id":56576035,"diff_hunk":"@@ -0,0 +1,39 @@\n+class V1::InventoriesController < ApplicationController\n+\n+  before_action :authenticate_user!\n+\n+  def index\n+    @inventories = Inventory.where(user: current_user)\n+  end\n+\n+  def create\n+    @inventory = Inventory.new\n+    @inventory.name = inventory_params[:name]\n+    unless inventory_params[:deadline].blank?\n+      begin\n+        @inventory.deadline = DateTime.strptime(inventory_params[:deadline], '%m/%d/%Y')\n+      rescue\n+        @inventory.errors.add(:deadline, 'must be in DD/MM/YYYY format')\n+        return render_error\n+      end\n+    end\n+    @inventory.district = District.find(inventory_params[:district][:id])\n+    @inventory.user = current_user","path":"app/controllers/v1/inventories_controller.rb","position":21,"original_position":21,"commit_id":"ada94c778b42ea204790e494bf6deb0b255d955f","original_commit_id":"ada94c778b42ea204790e494bf6deb0b255d955f","user":{"login":"bithavoc","id":219289,"avatar_url":"https://avatars.githubusercontent.com/u/219289?v=3","gravatar_id":"","url":"https://api.github.com/users/bithavoc","html_url":"https://github.com/bithavoc","followers_url":"https://api.github.com/users/bithavoc/followers","following_url":"https://api.github.com/users/bithavoc/following{/other_user}","gists_url":"https://api.github.com/users/bithavoc/gists{/gist_id}","starred_url":"https://api.github.com/users/bithavoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bithavoc/subscriptions","organizations_url":"https://api.github.com/users/bithavoc/orgs","repos_url":"https://api.github.com/users/bithavoc/repos","events_url":"https://api.github.com/users/bithavoc/events{/privacy}","received_events_url":"https://api.github.com/users/bithavoc/received_events","type":"User","site_admin":false},"body":"you can also do `@inventory = current_user.inventories.new(inventory_params.extract!(:name))`","created_at":"2016-03-17T20:55:13Z","updated_at":"2016-03-17T20:55:13Z","html_url":"https://github.com/MobilityLabs/pdredesign-server/pull/129#discussion_r56576035","pull_request_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/129","_links":{"self":{"href":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/comments/56576035"},"html":{"href":"https://github.com/MobilityLabs/pdredesign-server/pull/129#discussion_r56576035"},"pull_request":{"href":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/129"}}},"pull_request":{"url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/129","id":62932451,"html_url":"https://github.com/MobilityLabs/pdredesign-server/pull/129","diff_url":"https://github.com/MobilityLabs/pdredesign-server/pull/129.diff","patch_url":"https://github.com/MobilityLabs/pdredesign-server/pull/129.patch","issue_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/issues/129","number":129,"state":"open","locked":false,"title":"Closes #111: Creating a new Product Inventory","user":{"login":"MakotoTheKnight","id":1821302,"avatar_url":"https://avatars.githubusercontent.com/u/1821302?v=3","gravatar_id":"","url":"https://api.github.com/users/MakotoTheKnight","html_url":"https://github.com/MakotoTheKnight","followers_url":"https://api.github.com/users/MakotoTheKnight/followers","following_url":"https://api.github.com/users/MakotoTheKnight/following{/other_user}","gists_url":"https://api.github.com/users/MakotoTheKnight/gists{/gist_id}","starred_url":"https://api.github.com/users/MakotoTheKnight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MakotoTheKnight/subscriptions","organizations_url":"https://api.github.com/users/MakotoTheKnight/orgs","repos_url":"https://api.github.com/users/MakotoTheKnight/repos","events_url":"https://api.github.com/users/MakotoTheKnight/events{/privacy}","received_events_url":"https://api.github.com/users/MakotoTheKnight/received_events","type":"User","site_admin":false},"body":"This PR is good to go.  Notes:\r\n\r\n - This largely borrows from the assessment creation dialog, but there are some distinctions with it in that we always expect a district to exist for the user that is creating it.  If we need to adjust this logic, then we can opt to hide the creation for users who would not have a district attached.\r\n - There are a lot of reorganization bits in this commit; namely, we're moving around the Angular code away from a grouping by type to a grouping by role.\r\n - Some of the Angular controllers and directives were broken up, which preserved their behavior but also shifted around their respective code density.\r\n -  Certain directives that were touched were done so to introduce IIFEs and remove unused injections.","created_at":"2016-03-15T16:12:03Z","updated_at":"2016-03-17T20:55:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c53e1cd06a7c20cc2e0c5e1310a833b5c2bee7a4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/129/commits","review_comments_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/129/comments","review_comment_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/issues/129/comments","statuses_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/statuses/ada94c778b42ea204790e494bf6deb0b255d955f","head":{"label":"MobilityLabs:111-create-product-inventory","ref":"111-create-product-inventory","sha":"ada94c778b42ea204790e494bf6deb0b255d955f","user":{"login":"MobilityLabs","id":6536866,"avatar_url":"https://avatars.githubusercontent.com/u/6536866?v=3","gravatar_id":"","url":"https://api.github.com/users/MobilityLabs","html_url":"https://github.com/MobilityLabs","followers_url":"https://api.github.com/users/MobilityLabs/followers","following_url":"https://api.github.com/users/MobilityLabs/following{/other_user}","gists_url":"https://api.github.com/users/MobilityLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/MobilityLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobilityLabs/subscriptions","organizations_url":"https://api.github.com/users/MobilityLabs/orgs","repos_url":"https://api.github.com/users/MobilityLabs/repos","events_url":"https://api.github.com/users/MobilityLabs/events{/privacy}","received_events_url":"https://api.github.com/users/MobilityLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":19004072,"name":"pdredesign-server","full_name":"MobilityLabs/pdredesign-server","owner":{"login":"MobilityLabs","id":6536866,"avatar_url":"https://avatars.githubusercontent.com/u/6536866?v=3","gravatar_id":"","url":"https://api.github.com/users/MobilityLabs","html_url":"https://github.com/MobilityLabs","followers_url":"https://api.github.com/users/MobilityLabs/followers","following_url":"https://api.github.com/users/MobilityLabs/following{/other_user}","gists_url":"https://api.github.com/users/MobilityLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/MobilityLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobilityLabs/subscriptions","organizations_url":"https://api.github.com/users/MobilityLabs/orgs","repos_url":"https://api.github.com/users/MobilityLabs/repos","events_url":"https://api.github.com/users/MobilityLabs/events{/privacy}","received_events_url":"https://api.github.com/users/MobilityLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MobilityLabs/pdredesign-server","description":"PDRedesign api server","fork":false,"url":"https://api.github.com/repos/MobilityLabs/pdredesign-server","forks_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/forks","keys_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/teams","hooks_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/hooks","issue_events_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/issues/events{/number}","events_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/events","assignees_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/assignees{/user}","branches_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/branches{/branch}","tags_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/tags","blobs_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/statuses/{sha}","languages_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/languages","stargazers_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/stargazers","contributors_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/contributors","subscribers_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/subscribers","subscription_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/subscription","commits_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/contents/{+path}","compare_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/merges","archive_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/downloads","issues_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/issues{/number}","pulls_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls{/number}","milestones_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/milestones{/number}","notifications_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/labels{/name}","releases_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/releases{/id}","deployments_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/deployments","created_at":"2014-04-21T19:25:52Z","updated_at":"2016-02-22T22:56:59Z","pushed_at":"2016-03-17T18:22:24Z","git_url":"git://github.com/MobilityLabs/pdredesign-server.git","ssh_url":"git@github.com:MobilityLabs/pdredesign-server.git","clone_url":"https://github.com/MobilityLabs/pdredesign-server.git","svn_url":"https://github.com/MobilityLabs/pdredesign-server","homepage":null,"size":54972,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":45,"forks":1,"open_issues":45,"watchers":0,"default_branch":"master"}},"base":{"label":"MobilityLabs:staging","ref":"staging","sha":"96d6828e8a2fc099a0352dd4e8c6696cc1cd1bb3","user":{"login":"MobilityLabs","id":6536866,"avatar_url":"https://avatars.githubusercontent.com/u/6536866?v=3","gravatar_id":"","url":"https://api.github.com/users/MobilityLabs","html_url":"https://github.com/MobilityLabs","followers_url":"https://api.github.com/users/MobilityLabs/followers","following_url":"https://api.github.com/users/MobilityLabs/following{/other_user}","gists_url":"https://api.github.com/users/MobilityLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/MobilityLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobilityLabs/subscriptions","organizations_url":"https://api.github.com/users/MobilityLabs/orgs","repos_url":"https://api.github.com/users/MobilityLabs/repos","events_url":"https://api.github.com/users/MobilityLabs/events{/privacy}","received_events_url":"https://api.github.com/users/MobilityLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":19004072,"name":"pdredesign-server","full_name":"MobilityLabs/pdredesign-server","owner":{"login":"MobilityLabs","id":6536866,"avatar_url":"https://avatars.githubusercontent.com/u/6536866?v=3","gravatar_id":"","url":"https://api.github.com/users/MobilityLabs","html_url":"https://github.com/MobilityLabs","followers_url":"https://api.github.com/users/MobilityLabs/followers","following_url":"https://api.github.com/users/MobilityLabs/following{/other_user}","gists_url":"https://api.github.com/users/MobilityLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/MobilityLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobilityLabs/subscriptions","organizations_url":"https://api.github.com/users/MobilityLabs/orgs","repos_url":"https://api.github.com/users/MobilityLabs/repos","events_url":"https://api.github.com/users/MobilityLabs/events{/privacy}","received_events_url":"https://api.github.com/users/MobilityLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MobilityLabs/pdredesign-server","description":"PDRedesign api server","fork":false,"url":"https://api.github.com/repos/MobilityLabs/pdredesign-server","forks_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/forks","keys_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/teams","hooks_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/hooks","issue_events_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/issues/events{/number}","events_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/events","assignees_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/assignees{/user}","branches_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/branches{/branch}","tags_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/tags","blobs_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/statuses/{sha}","languages_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/languages","stargazers_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/stargazers","contributors_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/contributors","subscribers_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/subscribers","subscription_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/subscription","commits_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/contents/{+path}","compare_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/merges","archive_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/downloads","issues_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/issues{/number}","pulls_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls{/number}","milestones_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/milestones{/number}","notifications_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/labels{/name}","releases_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/releases{/id}","deployments_url":"https://api.github.com/repos/MobilityLabs/pdredesign-server/deployments","created_at":"2014-04-21T19:25:52Z","updated_at":"2016-02-22T22:56:59Z","pushed_at":"2016-03-17T18:22:24Z","git_url":"git://github.com/MobilityLabs/pdredesign-server.git","ssh_url":"git@github.com:MobilityLabs/pdredesign-server.git","clone_url":"https://github.com/MobilityLabs/pdredesign-server.git","svn_url":"https://github.com/MobilityLabs/pdredesign-server","homepage":null,"size":54972,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":45,"forks":1,"open_issues":45,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/129"},"html":{"href":"https://github.com/MobilityLabs/pdredesign-server/pull/129"},"issue":{"href":"https://api.github.com/repos/MobilityLabs/pdredesign-server/issues/129"},"comments":{"href":"https://api.github.com/repos/MobilityLabs/pdredesign-server/issues/129/comments"},"review_comments":{"href":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/129/comments"},"review_comment":{"href":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MobilityLabs/pdredesign-server/pulls/129/commits"},"statuses":{"href":"https://api.github.com/repos/MobilityLabs/pdredesign-server/statuses/ada94c778b42ea204790e494bf6deb0b255d955f"}}}}