Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: corrected get last ar filed date method #3001

Merged
merged 4 commits into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions colin-api/src/colin_api/models/filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
ShareObject, # noqa: I001
) # noqa: I001
from colin_api.resources.db import DB
from colin_api.utils import convert_to_json_date, convert_to_json_datetime, convert_to_snake
from colin_api.utils import convert_to_json_date, convert_to_json_datetime, convert_to_pacific_time, convert_to_snake


# Code smells:
Expand Down Expand Up @@ -1297,8 +1297,17 @@ def add_filing(cls, con, filing: Filing) -> int:
@classmethod
def _get_last_ar_filed_date(cls, header: dict, business: dict):
filing_year = header.get('filingYear')
recognition_dt = datetime.datetime.fromisoformat(business.get('business').get('foundingDate')).date()
last_ar_filed_dt = f'{filing_year}-{recognition_dt.month}-{recognition_dt.day}'
founding_date_str = business.get('business').get('foundingDate')

# If the founding date has `-00:00`, replace it with `+00:00` before passing to the function
if '-00:00' in founding_date_str:
founding_date_str = founding_date_str.replace('-00:00', '+00:00')
Comment on lines +1302 to +1304
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not really sure about this. Approving it since this function is used only for Business AR sync


pacific_founding_date = datetime.datetime.fromisoformat(
convert_to_pacific_time(founding_date_str)
).date()

last_ar_filed_dt = f'{filing_year}-{pacific_founding_date.month:02}-{pacific_founding_date.day:02}'
return last_ar_filed_dt

@classmethod
Expand Down
Loading