Skip to content

Commit

Permalink
ensure P&L report stream works even if current period has no data
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyyid committed May 3, 2021
1 parent 8cc077b commit 7fb9f67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_version():
readme = f.read()

setup(name='tap-quickbooks',
version='1.4.31',
version='1.4.32',
description='Singer.io tap for extracting data from the Quickbooks API',
author='hotglue',
url='http://hotglue.xyz/',
Expand Down
4 changes: 2 additions & 2 deletions tap_quickbooks/quickbooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,6 @@ def query(self, catalog_entry, state):
self.api_type))

def query_report(self, catalog_entry, state):

reader = ProfitAndLossDetailReport(self)
start_date = self.get_start_date(state, catalog_entry)
reader = ProfitAndLossDetailReport(self, start_date)
return reader.sync(catalog_entry)
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ class ProfitAndLossDetailReport(QuickbooksStream):
key_properties: ClassVar[List[str]] = []
replication_method: ClassVar[str] = 'FULL_TABLE'

def __init__(self, qb):
def __init__(self, qb, start_date):
self.qb = qb
self.start_date = start_date

def _get_column_metadata(self, resp):
columns = []
Expand Down Expand Up @@ -51,7 +52,7 @@ def _recursive_row_search(self, row, output, categories):
categories.pop()

def sync(self, catalog_entry):

LOGGER.info(f"ignoring config start date {self.start_date}")
end_date = datetime.date.today()

for i in range(NUMBER_OF_PERIODS):
Expand All @@ -73,7 +74,9 @@ def sync(self, catalog_entry):
row_array = row_group.get("Row")

if row_array is None:
return
# Update end date
end_date = start_date - datetime.timedelta(days=1)
continue

output = []
categories = []
Expand Down

0 comments on commit 7fb9f67

Please sign in to comment.