{"action":"created","comment":{"url":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/comments/37248620","id":37248620,"diff_hunk":"@@ -47,59 +49,70 @@ def update_shipments(shipments)\n \n       log << \"Found %d countries \\n\" % countries.size\n \n-      orders.each do |order|\n-\n-        # delete from shipment hash to reduce future lookup cost since we have\n-        # 1:1 shipments : orders\n-        shipment = shipments[:shipments].delete(order.number)\n+      csv_lines = []\n \n-        if shipment.nil?\n-          log << \"Could not find newgistics shipment order_id=%d \\n\" % order.id\n-          next\n-        end\n+      orders.each do |order|\n+        begin\n+          # delete from shipment hash to reduce future lookup cost since we have\n+          # 1:1 shipments : orders\n+          shipment = shipments[:shipments].delete(order.number)\n+\n+          if shipment.nil?\n+            log << \"Could not find newgistics shipment order_id=%d \\n\" % order.id","path":"app/async/workers/orders_puller.rb","position":28,"original_position":28,"commit_id":"ed2db77c5ed1669637c78e18e4e6469f48121097","original_commit_id":"ed2db77c5ed1669637c78e18e4e6469f48121097","user":{"login":"jmataya","id":677485,"avatar_url":"https://avatars.githubusercontent.com/u/677485?v=3","gravatar_id":"","url":"https://api.github.com/users/jmataya","html_url":"https://github.com/jmataya","followers_url":"https://api.github.com/users/jmataya/followers","following_url":"https://api.github.com/users/jmataya/following{/other_user}","gists_url":"https://api.github.com/users/jmataya/gists{/gist_id}","starred_url":"https://api.github.com/users/jmataya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmataya/subscriptions","organizations_url":"https://api.github.com/users/jmataya/orgs","repos_url":"https://api.github.com/users/jmataya/repos","events_url":"https://api.github.com/users/jmataya/events{/privacy}","received_events_url":"https://api.github.com/users/jmataya/received_events","type":"User","site_admin":false},"body":"Could you clean up this error message a little bit? And also, put order number in the logs, because that is the foreign key that references back to Newgistics.\r\n\r\nMaybe something like this:\r\n\r\n```ruby\r\nlog << \"Could not find Newgistics shipment for order number %s\\n\" % order.number\r\n```","created_at":"2015-08-17T23:18:14Z","updated_at":"2015-08-17T23:18:14Z","html_url":"https://github.com/FoxComm/spree_newgistics/pull/28#discussion_r37248620","pull_request_url":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/comments/37248620"},"html":{"href":"https://github.com/FoxComm/spree_newgistics/pull/28#discussion_r37248620"},"pull_request":{"href":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/28","id":42241487,"html_url":"https://github.com/FoxComm/spree_newgistics/pull/28","diff_url":"https://github.com/FoxComm/spree_newgistics/pull/28.diff","patch_url":"https://github.com/FoxComm/spree_newgistics/pull/28.patch","issue_url":"https://api.github.com/repos/FoxComm/spree_newgistics/issues/28","number":28,"state":"open","locked":false,"title":"NG state and Shipment state do not match between NG and Admin","user":{"login":"Axblade","id":771978,"avatar_url":"https://avatars.githubusercontent.com/u/771978?v=3","gravatar_id":"","url":"https://api.github.com/users/Axblade","html_url":"https://github.com/Axblade","followers_url":"https://api.github.com/users/Axblade/followers","following_url":"https://api.github.com/users/Axblade/following{/other_user}","gists_url":"https://api.github.com/users/Axblade/gists{/gist_id}","starred_url":"https://api.github.com/users/Axblade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Axblade/subscriptions","organizations_url":"https://api.github.com/users/Axblade/orgs","repos_url":"https://api.github.com/users/Axblade/repos","events_url":"https://api.github.com/users/Axblade/events{/privacy}","received_events_url":"https://api.github.com/users/Axblade/received_events","type":"User","site_admin":false},"body":"- [x] handle exception thrown when state cannot be updated\r\n- [x] put all orders producing error in CSV file\r\n- [x] send CSV file via email\r\n- [x] write tests","created_at":"2015-08-12T13:49:45Z","updated_at":"2015-08-17T23:18:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"003cd7a02c29a5e7aa7c6f247c6b77705c6e04f6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/28/commits","review_comments_url":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/28/comments","review_comment_url":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FoxComm/spree_newgistics/issues/28/comments","statuses_url":"https://api.github.com/repos/FoxComm/spree_newgistics/statuses/ed2db77c5ed1669637c78e18e4e6469f48121097","head":{"label":"FoxComm:bug/newgistics-state-does-not-update-correctly","ref":"bug/newgistics-state-does-not-update-correctly","sha":"ed2db77c5ed1669637c78e18e4e6469f48121097","user":{"login":"FoxComm","id":7478670,"avatar_url":"https://avatars.githubusercontent.com/u/7478670?v=3","gravatar_id":"","url":"https://api.github.com/users/FoxComm","html_url":"https://github.com/FoxComm","followers_url":"https://api.github.com/users/FoxComm/followers","following_url":"https://api.github.com/users/FoxComm/following{/other_user}","gists_url":"https://api.github.com/users/FoxComm/gists{/gist_id}","starred_url":"https://api.github.com/users/FoxComm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FoxComm/subscriptions","organizations_url":"https://api.github.com/users/FoxComm/orgs","repos_url":"https://api.github.com/users/FoxComm/repos","events_url":"https://api.github.com/users/FoxComm/events{/privacy}","received_events_url":"https://api.github.com/users/FoxComm/received_events","type":"Organization","site_admin":false},"repo":{"id":28942969,"name":"spree_newgistics","full_name":"FoxComm/spree_newgistics","owner":{"login":"FoxComm","id":7478670,"avatar_url":"https://avatars.githubusercontent.com/u/7478670?v=3","gravatar_id":"","url":"https://api.github.com/users/FoxComm","html_url":"https://github.com/FoxComm","followers_url":"https://api.github.com/users/FoxComm/followers","following_url":"https://api.github.com/users/FoxComm/following{/other_user}","gists_url":"https://api.github.com/users/FoxComm/gists{/gist_id}","starred_url":"https://api.github.com/users/FoxComm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FoxComm/subscriptions","organizations_url":"https://api.github.com/users/FoxComm/orgs","repos_url":"https://api.github.com/users/FoxComm/repos","events_url":"https://api.github.com/users/FoxComm/events{/privacy}","received_events_url":"https://api.github.com/users/FoxComm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FoxComm/spree_newgistics","description":"","fork":true,"url":"https://api.github.com/repos/FoxComm/spree_newgistics","forks_url":"https://api.github.com/repos/FoxComm/spree_newgistics/forks","keys_url":"https://api.github.com/repos/FoxComm/spree_newgistics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FoxComm/spree_newgistics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FoxComm/spree_newgistics/teams","hooks_url":"https://api.github.com/repos/FoxComm/spree_newgistics/hooks","issue_events_url":"https://api.github.com/repos/FoxComm/spree_newgistics/issues/events{/number}","events_url":"https://api.github.com/repos/FoxComm/spree_newgistics/events","assignees_url":"https://api.github.com/repos/FoxComm/spree_newgistics/assignees{/user}","branches_url":"https://api.github.com/repos/FoxComm/spree_newgistics/branches{/branch}","tags_url":"https://api.github.com/repos/FoxComm/spree_newgistics/tags","blobs_url":"https://api.github.com/repos/FoxComm/spree_newgistics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FoxComm/spree_newgistics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FoxComm/spree_newgistics/git/refs{/sha}","trees_url":"https://api.github.com/repos/FoxComm/spree_newgistics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FoxComm/spree_newgistics/statuses/{sha}","languages_url":"https://api.github.com/repos/FoxComm/spree_newgistics/languages","stargazers_url":"https://api.github.com/repos/FoxComm/spree_newgistics/stargazers","contributors_url":"https://api.github.com/repos/FoxComm/spree_newgistics/contributors","subscribers_url":"https://api.github.com/repos/FoxComm/spree_newgistics/subscribers","subscription_url":"https://api.github.com/repos/FoxComm/spree_newgistics/subscription","commits_url":"https://api.github.com/repos/FoxComm/spree_newgistics/commits{/sha}","git_commits_url":"https://api.github.com/repos/FoxComm/spree_newgistics/git/commits{/sha}","comments_url":"https://api.github.com/repos/FoxComm/spree_newgistics/comments{/number}","issue_comment_url":"https://api.github.com/repos/FoxComm/spree_newgistics/issues/comments{/number}","contents_url":"https://api.github.com/repos/FoxComm/spree_newgistics/contents/{+path}","compare_url":"https://api.github.com/repos/FoxComm/spree_newgistics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FoxComm/spree_newgistics/merges","archive_url":"https://api.github.com/repos/FoxComm/spree_newgistics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FoxComm/spree_newgistics/downloads","issues_url":"https://api.github.com/repos/FoxComm/spree_newgistics/issues{/number}","pulls_url":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls{/number}","milestones_url":"https://api.github.com/repos/FoxComm/spree_newgistics/milestones{/number}","notifications_url":"https://api.github.com/repos/FoxComm/spree_newgistics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FoxComm/spree_newgistics/labels{/name}","releases_url":"https://api.github.com/repos/FoxComm/spree_newgistics/releases{/id}","created_at":"2015-01-08T01:35:00Z","updated_at":"2015-05-22T15:40:40Z","pushed_at":"2015-08-17T23:11:13Z","git_url":"git://github.com/FoxComm/spree_newgistics.git","ssh_url":"git@github.com:FoxComm/spree_newgistics.git","clone_url":"https://github.com/FoxComm/spree_newgistics.git","svn_url":"https://github.com/FoxComm/spree_newgistics","homepage":"","size":802,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":1,"default_branch":"master"}},"base":{"label":"FoxComm:2-2-stable","ref":"2-2-stable","sha":"3232d5e7337e02c16b51b1046d348c34c1a91c83","user":{"login":"FoxComm","id":7478670,"avatar_url":"https://avatars.githubusercontent.com/u/7478670?v=3","gravatar_id":"","url":"https://api.github.com/users/FoxComm","html_url":"https://github.com/FoxComm","followers_url":"https://api.github.com/users/FoxComm/followers","following_url":"https://api.github.com/users/FoxComm/following{/other_user}","gists_url":"https://api.github.com/users/FoxComm/gists{/gist_id}","starred_url":"https://api.github.com/users/FoxComm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FoxComm/subscriptions","organizations_url":"https://api.github.com/users/FoxComm/orgs","repos_url":"https://api.github.com/users/FoxComm/repos","events_url":"https://api.github.com/users/FoxComm/events{/privacy}","received_events_url":"https://api.github.com/users/FoxComm/received_events","type":"Organization","site_admin":false},"repo":{"id":28942969,"name":"spree_newgistics","full_name":"FoxComm/spree_newgistics","owner":{"login":"FoxComm","id":7478670,"avatar_url":"https://avatars.githubusercontent.com/u/7478670?v=3","gravatar_id":"","url":"https://api.github.com/users/FoxComm","html_url":"https://github.com/FoxComm","followers_url":"https://api.github.com/users/FoxComm/followers","following_url":"https://api.github.com/users/FoxComm/following{/other_user}","gists_url":"https://api.github.com/users/FoxComm/gists{/gist_id}","starred_url":"https://api.github.com/users/FoxComm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FoxComm/subscriptions","organizations_url":"https://api.github.com/users/FoxComm/orgs","repos_url":"https://api.github.com/users/FoxComm/repos","events_url":"https://api.github.com/users/FoxComm/events{/privacy}","received_events_url":"https://api.github.com/users/FoxComm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FoxComm/spree_newgistics","description":"","fork":true,"url":"https://api.github.com/repos/FoxComm/spree_newgistics","forks_url":"https://api.github.com/repos/FoxComm/spree_newgistics/forks","keys_url":"https://api.github.com/repos/FoxComm/spree_newgistics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FoxComm/spree_newgistics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FoxComm/spree_newgistics/teams","hooks_url":"https://api.github.com/repos/FoxComm/spree_newgistics/hooks","issue_events_url":"https://api.github.com/repos/FoxComm/spree_newgistics/issues/events{/number}","events_url":"https://api.github.com/repos/FoxComm/spree_newgistics/events","assignees_url":"https://api.github.com/repos/FoxComm/spree_newgistics/assignees{/user}","branches_url":"https://api.github.com/repos/FoxComm/spree_newgistics/branches{/branch}","tags_url":"https://api.github.com/repos/FoxComm/spree_newgistics/tags","blobs_url":"https://api.github.com/repos/FoxComm/spree_newgistics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FoxComm/spree_newgistics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FoxComm/spree_newgistics/git/refs{/sha}","trees_url":"https://api.github.com/repos/FoxComm/spree_newgistics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FoxComm/spree_newgistics/statuses/{sha}","languages_url":"https://api.github.com/repos/FoxComm/spree_newgistics/languages","stargazers_url":"https://api.github.com/repos/FoxComm/spree_newgistics/stargazers","contributors_url":"https://api.github.com/repos/FoxComm/spree_newgistics/contributors","subscribers_url":"https://api.github.com/repos/FoxComm/spree_newgistics/subscribers","subscription_url":"https://api.github.com/repos/FoxComm/spree_newgistics/subscription","commits_url":"https://api.github.com/repos/FoxComm/spree_newgistics/commits{/sha}","git_commits_url":"https://api.github.com/repos/FoxComm/spree_newgistics/git/commits{/sha}","comments_url":"https://api.github.com/repos/FoxComm/spree_newgistics/comments{/number}","issue_comment_url":"https://api.github.com/repos/FoxComm/spree_newgistics/issues/comments{/number}","contents_url":"https://api.github.com/repos/FoxComm/spree_newgistics/contents/{+path}","compare_url":"https://api.github.com/repos/FoxComm/spree_newgistics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FoxComm/spree_newgistics/merges","archive_url":"https://api.github.com/repos/FoxComm/spree_newgistics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FoxComm/spree_newgistics/downloads","issues_url":"https://api.github.com/repos/FoxComm/spree_newgistics/issues{/number}","pulls_url":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls{/number}","milestones_url":"https://api.github.com/repos/FoxComm/spree_newgistics/milestones{/number}","notifications_url":"https://api.github.com/repos/FoxComm/spree_newgistics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FoxComm/spree_newgistics/labels{/name}","releases_url":"https://api.github.com/repos/FoxComm/spree_newgistics/releases{/id}","created_at":"2015-01-08T01:35:00Z","updated_at":"2015-05-22T15:40:40Z","pushed_at":"2015-08-17T23:11:13Z","git_url":"git://github.com/FoxComm/spree_newgistics.git","ssh_url":"git@github.com:FoxComm/spree_newgistics.git","clone_url":"https://github.com/FoxComm/spree_newgistics.git","svn_url":"https://github.com/FoxComm/spree_newgistics","homepage":"","size":802,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/28"},"html":{"href":"https://github.com/FoxComm/spree_newgistics/pull/28"},"issue":{"href":"https://api.github.com/repos/FoxComm/spree_newgistics/issues/28"},"comments":{"href":"https://api.github.com/repos/FoxComm/spree_newgistics/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FoxComm/spree_newgistics/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/FoxComm/spree_newgistics/statuses/ed2db77c5ed1669637c78e18e4e6469f48121097"}}}}