diff --git a/pyproject.toml b/pyproject.toml index 2d702c9..461bd6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tap-gainsightpx" -version = "1.0.6" +version = "1.0.7" description = "`tap-gainsightpx` is a Singer tap for GainsightPX, built with the Meltano Singer SDK." authors = ["Josh Lloyd"] keywords = [ diff --git a/tap_gainsightpx/paginators.py b/tap_gainsightpx/paginators.py index d4335d5..2adf853 100644 --- a/tap_gainsightpx/paginators.py +++ b/tap_gainsightpx/paginators.py @@ -31,13 +31,14 @@ def has_more(self, response: Response) -> bool: total_hits = res.get("totalHits") records_key = re.findall(r"\$\.(.*)\[\*\]", self._records_jsonpath)[0] - has_more = False - if scroll_id is not None: - self.current_record_count += len(res[records_key]) - if total_hits > self.current_record_count: - has_more = True - - return has_more + response_record_count = len(res[records_key]) + self.current_record_count += response_record_count + if response_record_count == 0 or scroll_id is None: + return False + elif total_hits > self.current_record_count: + return True + + return False def advance(self, response: Response) -> None: """Get a new page value and advance the current one."""