{"action":"created","comment":{"url":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/comments/235105137","pull_request_review_id":176895028,"id":235105137,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNTEwNTEzNw==","diff_hunk":"@@ -157,12 +159,23 @@ def get_deal_ids(self, tap):\n \n             self.more_ids_to_get = self.more_items_in_collection  # note if there are more pages of ids to get\n             self.next_start = self.start  # note pagination for next loop\n-            ndeals = len(response.json()['data'])\n-            this_page_ids = [response.json()['data'][i]['id'] for i in range(ndeals) \n-                             if response.json()['data'][i]['stage_change_time'] is not None \n-                             and pendulum.parse(response.json()['data'][i]['stage_change_time']) < self.stream_start\n-                             and pendulum.parse(response.json()['data'][i]['stage_change_time']) >= checkpoint]\n-            \n+\n+            # find all deals ids for deals added or with stage changes after start and before stop\n+            this_page_ids = self.find_deal_ids(response.json()['data'], start=checkpoint, stop=self.stream_start)\n+\n             self.these_deals = this_page_ids  # need the list of deals to check for last id in the tap\n             for deal_id in this_page_ids:\n-                yield deal_id\n\\ No newline at end of file\n+                yield deal_id\n+\n+\n+    def find_deal_ids(self, data, start, stop):\n+\n+        # find all deals that were *added* after the start time and before the stop time\n+        added_ids = [data[i]['id'] for i in range(len(data)) if (start <= pendulum.parse(data[i]['add_time']) < stop)]\n+\n+        # find all deals that a) had a stage change at any time (i.e., the stage_change_time is not None),\n+        #                     b) had a stage change after the start time and before the stop time, and\n+        #                     c) are not in add_ids\n+        changed_ids = [data[i]['id'] for i in range(len(data)) if (data[i]['id'] not in added_ids) & (data[i]['stage_change_time'] is not None","path":"tap_pipedrive/stream.py","position":59,"original_position":59,"commit_id":"ce7eb9e300d47b224ea16c572320285e2623322f","original_commit_id":"ce7eb9e300d47b224ea16c572320285e2623322f","user":{"login":"luandy64","id":19473996,"node_id":"MDQ6VXNlcjE5NDczOTk2","avatar_url":"https://avatars1.githubusercontent.com/u/19473996?v=4","gravatar_id":"","url":"https://api.github.com/users/luandy64","html_url":"https://github.com/luandy64","followers_url":"https://api.github.com/users/luandy64/followers","following_url":"https://api.github.com/users/luandy64/following{/other_user}","gists_url":"https://api.github.com/users/luandy64/gists{/gist_id}","starred_url":"https://api.github.com/users/luandy64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luandy64/subscriptions","organizations_url":"https://api.github.com/users/luandy64/orgs","repos_url":"https://api.github.com/users/luandy64/repos","events_url":"https://api.github.com/users/luandy64/events{/privacy}","received_events_url":"https://api.github.com/users/luandy64/received_events","type":"User","site_admin":false},"body":"I don't know if changing the other one would improve its readability. So I'll let you make the call on that one.","created_at":"2018-11-20T17:46:52Z","updated_at":"2018-11-20T17:46:53Z","html_url":"https://github.com/singer-io/tap-pipedrive/pull/42#discussion_r235105137","pull_request_url":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/42","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/comments/235105137"},"html":{"href":"https://github.com/singer-io/tap-pipedrive/pull/42#discussion_r235105137"},"pull_request":{"href":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/42"}},"in_reply_to_id":235090945},"pull_request":{"url":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/42","id":226981111,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2OTgxMTEx","html_url":"https://github.com/singer-io/tap-pipedrive/pull/42","diff_url":"https://github.com/singer-io/tap-pipedrive/pull/42.diff","patch_url":"https://github.com/singer-io/tap-pipedrive/pull/42.patch","issue_url":"https://api.github.com/repos/singer-io/tap-pipedrive/issues/42","number":42,"state":"open","locked":false,"title":"changed dealflow bookmarking to check update_time, force UTC","user":{"login":"alewis-ce","id":42150229,"node_id":"MDQ6VXNlcjQyMTUwMjI5","avatar_url":"https://avatars0.githubusercontent.com/u/42150229?v=4","gravatar_id":"","url":"https://api.github.com/users/alewis-ce","html_url":"https://github.com/alewis-ce","followers_url":"https://api.github.com/users/alewis-ce/followers","following_url":"https://api.github.com/users/alewis-ce/following{/other_user}","gists_url":"https://api.github.com/users/alewis-ce/gists{/gist_id}","starred_url":"https://api.github.com/users/alewis-ce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alewis-ce/subscriptions","organizations_url":"https://api.github.com/users/alewis-ce/orgs","repos_url":"https://api.github.com/users/alewis-ce/repos","events_url":"https://api.github.com/users/alewis-ce/events{/privacy}","received_events_url":"https://api.github.com/users/alewis-ce/received_events","type":"User","site_admin":false},"body":"Changed dealflow to find deals with changes based on `update_time` instead of `stage_change_time`; also forced UTC for `stream_start` variable.","created_at":"2018-10-30T15:57:13Z","updated_at":"2018-11-20T17:46:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"069c449dba949a2d6bd6c5d62638cb77197442be","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/42/commits","review_comments_url":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/42/comments","review_comment_url":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/comments{/number}","comments_url":"https://api.github.com/repos/singer-io/tap-pipedrive/issues/42/comments","statuses_url":"https://api.github.com/repos/singer-io/tap-pipedrive/statuses/ce7eb9e300d47b224ea16c572320285e2623322f","head":{"label":"cross-entropy:dealflow-missing-deals","ref":"dealflow-missing-deals","sha":"ce7eb9e300d47b224ea16c572320285e2623322f","user":{"login":"cross-entropy","id":36750167,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NzUwMTY3","avatar_url":"https://avatars0.githubusercontent.com/u/36750167?v=4","gravatar_id":"","url":"https://api.github.com/users/cross-entropy","html_url":"https://github.com/cross-entropy","followers_url":"https://api.github.com/users/cross-entropy/followers","following_url":"https://api.github.com/users/cross-entropy/following{/other_user}","gists_url":"https://api.github.com/users/cross-entropy/gists{/gist_id}","starred_url":"https://api.github.com/users/cross-entropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cross-entropy/subscriptions","organizations_url":"https://api.github.com/users/cross-entropy/orgs","repos_url":"https://api.github.com/users/cross-entropy/repos","events_url":"https://api.github.com/users/cross-entropy/events{/privacy}","received_events_url":"https://api.github.com/users/cross-entropy/received_events","type":"Organization","site_admin":false},"repo":{"id":149507028,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk1MDcwMjg=","name":"tap-pipedrive","full_name":"cross-entropy/tap-pipedrive","private":false,"owner":{"login":"cross-entropy","id":36750167,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NzUwMTY3","avatar_url":"https://avatars0.githubusercontent.com/u/36750167?v=4","gravatar_id":"","url":"https://api.github.com/users/cross-entropy","html_url":"https://github.com/cross-entropy","followers_url":"https://api.github.com/users/cross-entropy/followers","following_url":"https://api.github.com/users/cross-entropy/following{/other_user}","gists_url":"https://api.github.com/users/cross-entropy/gists{/gist_id}","starred_url":"https://api.github.com/users/cross-entropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cross-entropy/subscriptions","organizations_url":"https://api.github.com/users/cross-entropy/orgs","repos_url":"https://api.github.com/users/cross-entropy/repos","events_url":"https://api.github.com/users/cross-entropy/events{/privacy}","received_events_url":"https://api.github.com/users/cross-entropy/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/cross-entropy/tap-pipedrive","description":"A Singer.io tap for extracting data from the Pipedrive API","fork":true,"url":"https://api.github.com/repos/cross-entropy/tap-pipedrive","forks_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/forks","keys_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/teams","hooks_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/hooks","issue_events_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/issues/events{/number}","events_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/events","assignees_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/assignees{/user}","branches_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/branches{/branch}","tags_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/tags","blobs_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/git/refs{/sha}","trees_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/statuses/{sha}","languages_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/languages","stargazers_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/stargazers","contributors_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/contributors","subscribers_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/subscribers","subscription_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/subscription","commits_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/commits{/sha}","git_commits_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/git/commits{/sha}","comments_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/comments{/number}","issue_comment_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/issues/comments{/number}","contents_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/contents/{+path}","compare_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/merges","archive_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/downloads","issues_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/issues{/number}","pulls_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/pulls{/number}","milestones_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/milestones{/number}","notifications_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/labels{/name}","releases_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/releases{/id}","deployments_url":"https://api.github.com/repos/cross-entropy/tap-pipedrive/deployments","created_at":"2018-09-19T20:15:03Z","updated_at":"2018-10-29T23:24:17Z","pushed_at":"2018-11-19T21:46:52Z","git_url":"git://github.com/cross-entropy/tap-pipedrive.git","ssh_url":"git@github.com:cross-entropy/tap-pipedrive.git","clone_url":"https://github.com/cross-entropy/tap-pipedrive.git","svn_url":"https://github.com/cross-entropy/tap-pipedrive","homepage":null,"size":125,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"singer-io:master","ref":"master","sha":"77627e4e67dd303b169778ae99db4b8961205e30","user":{"login":"singer-io","id":25538203,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1NTM4MjAz","avatar_url":"https://avatars0.githubusercontent.com/u/25538203?v=4","gravatar_id":"","url":"https://api.github.com/users/singer-io","html_url":"https://github.com/singer-io","followers_url":"https://api.github.com/users/singer-io/followers","following_url":"https://api.github.com/users/singer-io/following{/other_user}","gists_url":"https://api.github.com/users/singer-io/gists{/gist_id}","starred_url":"https://api.github.com/users/singer-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singer-io/subscriptions","organizations_url":"https://api.github.com/users/singer-io/orgs","repos_url":"https://api.github.com/users/singer-io/repos","events_url":"https://api.github.com/users/singer-io/events{/privacy}","received_events_url":"https://api.github.com/users/singer-io/received_events","type":"Organization","site_admin":false},"repo":{"id":100043340,"node_id":"MDEwOlJlcG9zaXRvcnkxMDAwNDMzNDA=","name":"tap-pipedrive","full_name":"singer-io/tap-pipedrive","private":false,"owner":{"login":"singer-io","id":25538203,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1NTM4MjAz","avatar_url":"https://avatars0.githubusercontent.com/u/25538203?v=4","gravatar_id":"","url":"https://api.github.com/users/singer-io","html_url":"https://github.com/singer-io","followers_url":"https://api.github.com/users/singer-io/followers","following_url":"https://api.github.com/users/singer-io/following{/other_user}","gists_url":"https://api.github.com/users/singer-io/gists{/gist_id}","starred_url":"https://api.github.com/users/singer-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singer-io/subscriptions","organizations_url":"https://api.github.com/users/singer-io/orgs","repos_url":"https://api.github.com/users/singer-io/repos","events_url":"https://api.github.com/users/singer-io/events{/privacy}","received_events_url":"https://api.github.com/users/singer-io/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/singer-io/tap-pipedrive","description":"A Singer.io tap for extracting data from the Pipedrive API","fork":false,"url":"https://api.github.com/repos/singer-io/tap-pipedrive","forks_url":"https://api.github.com/repos/singer-io/tap-pipedrive/forks","keys_url":"https://api.github.com/repos/singer-io/tap-pipedrive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/singer-io/tap-pipedrive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/singer-io/tap-pipedrive/teams","hooks_url":"https://api.github.com/repos/singer-io/tap-pipedrive/hooks","issue_events_url":"https://api.github.com/repos/singer-io/tap-pipedrive/issues/events{/number}","events_url":"https://api.github.com/repos/singer-io/tap-pipedrive/events","assignees_url":"https://api.github.com/repos/singer-io/tap-pipedrive/assignees{/user}","branches_url":"https://api.github.com/repos/singer-io/tap-pipedrive/branches{/branch}","tags_url":"https://api.github.com/repos/singer-io/tap-pipedrive/tags","blobs_url":"https://api.github.com/repos/singer-io/tap-pipedrive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/singer-io/tap-pipedrive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/singer-io/tap-pipedrive/git/refs{/sha}","trees_url":"https://api.github.com/repos/singer-io/tap-pipedrive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/singer-io/tap-pipedrive/statuses/{sha}","languages_url":"https://api.github.com/repos/singer-io/tap-pipedrive/languages","stargazers_url":"https://api.github.com/repos/singer-io/tap-pipedrive/stargazers","contributors_url":"https://api.github.com/repos/singer-io/tap-pipedrive/contributors","subscribers_url":"https://api.github.com/repos/singer-io/tap-pipedrive/subscribers","subscription_url":"https://api.github.com/repos/singer-io/tap-pipedrive/subscription","commits_url":"https://api.github.com/repos/singer-io/tap-pipedrive/commits{/sha}","git_commits_url":"https://api.github.com/repos/singer-io/tap-pipedrive/git/commits{/sha}","comments_url":"https://api.github.com/repos/singer-io/tap-pipedrive/comments{/number}","issue_comment_url":"https://api.github.com/repos/singer-io/tap-pipedrive/issues/comments{/number}","contents_url":"https://api.github.com/repos/singer-io/tap-pipedrive/contents/{+path}","compare_url":"https://api.github.com/repos/singer-io/tap-pipedrive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/singer-io/tap-pipedrive/merges","archive_url":"https://api.github.com/repos/singer-io/tap-pipedrive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/singer-io/tap-pipedrive/downloads","issues_url":"https://api.github.com/repos/singer-io/tap-pipedrive/issues{/number}","pulls_url":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls{/number}","milestones_url":"https://api.github.com/repos/singer-io/tap-pipedrive/milestones{/number}","notifications_url":"https://api.github.com/repos/singer-io/tap-pipedrive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/singer-io/tap-pipedrive/labels{/name}","releases_url":"https://api.github.com/repos/singer-io/tap-pipedrive/releases{/id}","deployments_url":"https://api.github.com/repos/singer-io/tap-pipedrive/deployments","created_at":"2017-08-11T15:01:27Z","updated_at":"2018-11-14T00:58:51Z","pushed_at":"2018-11-19T21:46:54Z","git_url":"git://github.com/singer-io/tap-pipedrive.git","ssh_url":"git@github.com:singer-io/tap-pipedrive.git","clone_url":"https://github.com/singer-io/tap-pipedrive.git","svn_url":"https://github.com/singer-io/tap-pipedrive","homepage":null,"size":124,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":8,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/42"},"html":{"href":"https://github.com/singer-io/tap-pipedrive/pull/42"},"issue":{"href":"https://api.github.com/repos/singer-io/tap-pipedrive/issues/42"},"comments":{"href":"https://api.github.com/repos/singer-io/tap-pipedrive/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/singer-io/tap-pipedrive/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/singer-io/tap-pipedrive/statuses/ce7eb9e300d47b224ea16c572320285e2623322f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"luandy64"}}