{"action":"created","comment":{"url":"https://api.github.com/repos/ndlib/annex-ims/pulls/comments/49120362","id":49120362,"diff_hunk":"@@ -0,0 +1,39 @@\n+# The system currently performs an optimistic creation of an item\n+# using whatever it's given as a barcode. This service was\n+# specifically added to clean up invalid items created due to things\n+# like receiving junk barcodes from the scanner.\n+module Lib\n+  module Tasks\n+    module Services\n+      class DestroyInvalidItems\n+        attr_reader :user\n+\n+        def self.call(user: user)\n+          new(user: user).destroy\n+        end\n+\n+        def initialize(user: user)\n+          @user = user\n+        end\n+\n+        def destroy\n+          items = Item.\n+            where(tray_id: nil).\n+            where(\"metadata_updated_at < ?\", 1.hour.ago).","path":"lib/tasks/services/destroy_invalid_items.rb","position":22,"original_position":22,"commit_id":"9c2c412231b940800e5fa5559291678dbd63fde8","original_commit_id":"9c2c412231b940800e5fa5559291678dbd63fde8","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Align the operands of an expression in an assignment spanning multiple lines.","created_at":"2016-01-07T20:15:23Z","updated_at":"2016-01-07T20:15:23Z","html_url":"https://github.com/ndlib/annex-ims/pull/131#discussion_r49120362","pull_request_url":"https://api.github.com/repos/ndlib/annex-ims/pulls/131","_links":{"self":{"href":"https://api.github.com/repos/ndlib/annex-ims/pulls/comments/49120362"},"html":{"href":"https://github.com/ndlib/annex-ims/pull/131#discussion_r49120362"},"pull_request":{"href":"https://api.github.com/repos/ndlib/annex-ims/pulls/131"}}},"pull_request":{"url":"https://api.github.com/repos/ndlib/annex-ims/pulls/131","id":55384547,"html_url":"https://github.com/ndlib/annex-ims/pull/131","diff_url":"https://github.com/ndlib/annex-ims/pull/131.diff","patch_url":"https://github.com/ndlib/annex-ims/pull/131.patch","issue_url":"https://api.github.com/repos/ndlib/annex-ims/issues/131","number":131,"state":"open","locked":false,"title":"AIMS-219: Cleanup \"not found\" items that are not associated with a tray","user":{"login":"jgondron","id":11502744,"avatar_url":"https://avatars.githubusercontent.com/u/11502744?v=3","gravatar_id":"","url":"https://api.github.com/users/jgondron","html_url":"https://github.com/jgondron","followers_url":"https://api.github.com/users/jgondron/followers","following_url":"https://api.github.com/users/jgondron/following{/other_user}","gists_url":"https://api.github.com/users/jgondron/gists{/gist_id}","starred_url":"https://api.github.com/users/jgondron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgondron/subscriptions","organizations_url":"https://api.github.com/users/jgondron/orgs","repos_url":"https://api.github.com/users/jgondron/repos","events_url":"https://api.github.com/users/jgondron/events{/privacy}","received_events_url":"https://api.github.com/users/jgondron/received_events","type":"User","site_admin":false},"body":"Why: A lot of items have been added to the system using junk data from the barcode scanner due to the way we optimistically create an item, then look up its info later. This is getting in the way of querying/viewing valid items.\r\nHow: Created a rake task to destroy all items that are not assigned to a tray and are either \"not found\" or \"not marked for annex\". This task will be run adhoc to clean up the data (such as during our next deploy). Future development such as input validation should begin to prevent this data from being created, so a cron job is likely not needed, but if we do end up creating one, it can just use this rake task.","created_at":"2016-01-07T20:15:19Z","updated_at":"2016-01-07T20:15:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c18da51f700f40ec607788fdf88b79a3086f7021","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ndlib/annex-ims/pulls/131/commits","review_comments_url":"https://api.github.com/repos/ndlib/annex-ims/pulls/131/comments","review_comment_url":"https://api.github.com/repos/ndlib/annex-ims/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ndlib/annex-ims/issues/131/comments","statuses_url":"https://api.github.com/repos/ndlib/annex-ims/statuses/9c2c412231b940800e5fa5559291678dbd63fde8","head":{"label":"ndlib:AIMS-219-Cleanup-invalid-items","ref":"AIMS-219-Cleanup-invalid-items","sha":"9c2c412231b940800e5fa5559291678dbd63fde8","user":{"login":"ndlib","id":160943,"avatar_url":"https://avatars.githubusercontent.com/u/160943?v=3","gravatar_id":"","url":"https://api.github.com/users/ndlib","html_url":"https://github.com/ndlib","followers_url":"https://api.github.com/users/ndlib/followers","following_url":"https://api.github.com/users/ndlib/following{/other_user}","gists_url":"https://api.github.com/users/ndlib/gists{/gist_id}","starred_url":"https://api.github.com/users/ndlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndlib/subscriptions","organizations_url":"https://api.github.com/users/ndlib/orgs","repos_url":"https://api.github.com/users/ndlib/repos","events_url":"https://api.github.com/users/ndlib/events{/privacy}","received_events_url":"https://api.github.com/users/ndlib/received_events","type":"Organization","site_admin":false},"repo":{"id":27182637,"name":"annex-ims","full_name":"ndlib/annex-ims","owner":{"login":"ndlib","id":160943,"avatar_url":"https://avatars.githubusercontent.com/u/160943?v=3","gravatar_id":"","url":"https://api.github.com/users/ndlib","html_url":"https://github.com/ndlib","followers_url":"https://api.github.com/users/ndlib/followers","following_url":"https://api.github.com/users/ndlib/following{/other_user}","gists_url":"https://api.github.com/users/ndlib/gists{/gist_id}","starred_url":"https://api.github.com/users/ndlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndlib/subscriptions","organizations_url":"https://api.github.com/users/ndlib/orgs","repos_url":"https://api.github.com/users/ndlib/repos","events_url":"https://api.github.com/users/ndlib/events{/privacy}","received_events_url":"https://api.github.com/users/ndlib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ndlib/annex-ims","description":"IRIS: Integrated Retrieval and Inventory System","fork":false,"url":"https://api.github.com/repos/ndlib/annex-ims","forks_url":"https://api.github.com/repos/ndlib/annex-ims/forks","keys_url":"https://api.github.com/repos/ndlib/annex-ims/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ndlib/annex-ims/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ndlib/annex-ims/teams","hooks_url":"https://api.github.com/repos/ndlib/annex-ims/hooks","issue_events_url":"https://api.github.com/repos/ndlib/annex-ims/issues/events{/number}","events_url":"https://api.github.com/repos/ndlib/annex-ims/events","assignees_url":"https://api.github.com/repos/ndlib/annex-ims/assignees{/user}","branches_url":"https://api.github.com/repos/ndlib/annex-ims/branches{/branch}","tags_url":"https://api.github.com/repos/ndlib/annex-ims/tags","blobs_url":"https://api.github.com/repos/ndlib/annex-ims/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ndlib/annex-ims/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ndlib/annex-ims/git/refs{/sha}","trees_url":"https://api.github.com/repos/ndlib/annex-ims/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ndlib/annex-ims/statuses/{sha}","languages_url":"https://api.github.com/repos/ndlib/annex-ims/languages","stargazers_url":"https://api.github.com/repos/ndlib/annex-ims/stargazers","contributors_url":"https://api.github.com/repos/ndlib/annex-ims/contributors","subscribers_url":"https://api.github.com/repos/ndlib/annex-ims/subscribers","subscription_url":"https://api.github.com/repos/ndlib/annex-ims/subscription","commits_url":"https://api.github.com/repos/ndlib/annex-ims/commits{/sha}","git_commits_url":"https://api.github.com/repos/ndlib/annex-ims/git/commits{/sha}","comments_url":"https://api.github.com/repos/ndlib/annex-ims/comments{/number}","issue_comment_url":"https://api.github.com/repos/ndlib/annex-ims/issues/comments{/number}","contents_url":"https://api.github.com/repos/ndlib/annex-ims/contents/{+path}","compare_url":"https://api.github.com/repos/ndlib/annex-ims/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ndlib/annex-ims/merges","archive_url":"https://api.github.com/repos/ndlib/annex-ims/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ndlib/annex-ims/downloads","issues_url":"https://api.github.com/repos/ndlib/annex-ims/issues{/number}","pulls_url":"https://api.github.com/repos/ndlib/annex-ims/pulls{/number}","milestones_url":"https://api.github.com/repos/ndlib/annex-ims/milestones{/number}","notifications_url":"https://api.github.com/repos/ndlib/annex-ims/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ndlib/annex-ims/labels{/name}","releases_url":"https://api.github.com/repos/ndlib/annex-ims/releases{/id}","created_at":"2014-11-26T15:16:57Z","updated_at":"2015-08-17T18:52:28Z","pushed_at":"2016-01-07T20:15:20Z","git_url":"git://github.com/ndlib/annex-ims.git","ssh_url":"git@github.com:ndlib/annex-ims.git","clone_url":"https://github.com/ndlib/annex-ims.git","svn_url":"https://github.com/ndlib/annex-ims","homepage":"","size":1002,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"ndlib:master","ref":"master","sha":"3192e641cbfd1b00330e8e3663b88e49ef7146a7","user":{"login":"ndlib","id":160943,"avatar_url":"https://avatars.githubusercontent.com/u/160943?v=3","gravatar_id":"","url":"https://api.github.com/users/ndlib","html_url":"https://github.com/ndlib","followers_url":"https://api.github.com/users/ndlib/followers","following_url":"https://api.github.com/users/ndlib/following{/other_user}","gists_url":"https://api.github.com/users/ndlib/gists{/gist_id}","starred_url":"https://api.github.com/users/ndlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndlib/subscriptions","organizations_url":"https://api.github.com/users/ndlib/orgs","repos_url":"https://api.github.com/users/ndlib/repos","events_url":"https://api.github.com/users/ndlib/events{/privacy}","received_events_url":"https://api.github.com/users/ndlib/received_events","type":"Organization","site_admin":false},"repo":{"id":27182637,"name":"annex-ims","full_name":"ndlib/annex-ims","owner":{"login":"ndlib","id":160943,"avatar_url":"https://avatars.githubusercontent.com/u/160943?v=3","gravatar_id":"","url":"https://api.github.com/users/ndlib","html_url":"https://github.com/ndlib","followers_url":"https://api.github.com/users/ndlib/followers","following_url":"https://api.github.com/users/ndlib/following{/other_user}","gists_url":"https://api.github.com/users/ndlib/gists{/gist_id}","starred_url":"https://api.github.com/users/ndlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndlib/subscriptions","organizations_url":"https://api.github.com/users/ndlib/orgs","repos_url":"https://api.github.com/users/ndlib/repos","events_url":"https://api.github.com/users/ndlib/events{/privacy}","received_events_url":"https://api.github.com/users/ndlib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ndlib/annex-ims","description":"IRIS: Integrated Retrieval and Inventory System","fork":false,"url":"https://api.github.com/repos/ndlib/annex-ims","forks_url":"https://api.github.com/repos/ndlib/annex-ims/forks","keys_url":"https://api.github.com/repos/ndlib/annex-ims/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ndlib/annex-ims/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ndlib/annex-ims/teams","hooks_url":"https://api.github.com/repos/ndlib/annex-ims/hooks","issue_events_url":"https://api.github.com/repos/ndlib/annex-ims/issues/events{/number}","events_url":"https://api.github.com/repos/ndlib/annex-ims/events","assignees_url":"https://api.github.com/repos/ndlib/annex-ims/assignees{/user}","branches_url":"https://api.github.com/repos/ndlib/annex-ims/branches{/branch}","tags_url":"https://api.github.com/repos/ndlib/annex-ims/tags","blobs_url":"https://api.github.com/repos/ndlib/annex-ims/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ndlib/annex-ims/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ndlib/annex-ims/git/refs{/sha}","trees_url":"https://api.github.com/repos/ndlib/annex-ims/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ndlib/annex-ims/statuses/{sha}","languages_url":"https://api.github.com/repos/ndlib/annex-ims/languages","stargazers_url":"https://api.github.com/repos/ndlib/annex-ims/stargazers","contributors_url":"https://api.github.com/repos/ndlib/annex-ims/contributors","subscribers_url":"https://api.github.com/repos/ndlib/annex-ims/subscribers","subscription_url":"https://api.github.com/repos/ndlib/annex-ims/subscription","commits_url":"https://api.github.com/repos/ndlib/annex-ims/commits{/sha}","git_commits_url":"https://api.github.com/repos/ndlib/annex-ims/git/commits{/sha}","comments_url":"https://api.github.com/repos/ndlib/annex-ims/comments{/number}","issue_comment_url":"https://api.github.com/repos/ndlib/annex-ims/issues/comments{/number}","contents_url":"https://api.github.com/repos/ndlib/annex-ims/contents/{+path}","compare_url":"https://api.github.com/repos/ndlib/annex-ims/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ndlib/annex-ims/merges","archive_url":"https://api.github.com/repos/ndlib/annex-ims/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ndlib/annex-ims/downloads","issues_url":"https://api.github.com/repos/ndlib/annex-ims/issues{/number}","pulls_url":"https://api.github.com/repos/ndlib/annex-ims/pulls{/number}","milestones_url":"https://api.github.com/repos/ndlib/annex-ims/milestones{/number}","notifications_url":"https://api.github.com/repos/ndlib/annex-ims/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ndlib/annex-ims/labels{/name}","releases_url":"https://api.github.com/repos/ndlib/annex-ims/releases{/id}","created_at":"2014-11-26T15:16:57Z","updated_at":"2015-08-17T18:52:28Z","pushed_at":"2016-01-07T20:15:20Z","git_url":"git://github.com/ndlib/annex-ims.git","ssh_url":"git@github.com:ndlib/annex-ims.git","clone_url":"https://github.com/ndlib/annex-ims.git","svn_url":"https://github.com/ndlib/annex-ims","homepage":"","size":1002,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ndlib/annex-ims/pulls/131"},"html":{"href":"https://github.com/ndlib/annex-ims/pull/131"},"issue":{"href":"https://api.github.com/repos/ndlib/annex-ims/issues/131"},"comments":{"href":"https://api.github.com/repos/ndlib/annex-ims/issues/131/comments"},"review_comments":{"href":"https://api.github.com/repos/ndlib/annex-ims/pulls/131/comments"},"review_comment":{"href":"https://api.github.com/repos/ndlib/annex-ims/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ndlib/annex-ims/pulls/131/commits"},"statuses":{"href":"https://api.github.com/repos/ndlib/annex-ims/statuses/9c2c412231b940800e5fa5559291678dbd63fde8"}}}}