Skip to content

Commit

Permalink
Fix GET filing document list issue & amalgamation related error
Browse files Browse the repository at this point in the history
  • Loading branch information
argush3 committed Mar 18, 2024
1 parent 702231a commit bfb2ec0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions legal-api/src/legal_api/models/legal_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,15 @@ def _extend_json(self, d):
if self.fiscal_year_end_date:
d["fiscalYearEndDate"] = datetime.date(self.fiscal_year_end_date).isoformat()
if self.state_filing_id:
if self.state == LegalEntity.State.HISTORICAL and (
amalgamating_business := self.amalgamating_businesses.one_or_none()
):
amalgamation = Amalgamation.find_by_id(amalgamating_business.amalgamation_id)
d["amalgamatedInto"] = amalgamation.json()
else:
d["stateFiling"] = f"{base_url}/{self.identifier}/filings/{self.state_filing_id}"
# TODO: revert once amalgamation tables and migration scripts have been run
# if self.state == LegalEntity.State.HISTORICAL and (
# amalgamating_business := self.amalgamating_businesses.one_or_none()
# ):
# amalgamation = Amalgamation.find_by_id(amalgamating_business.amalgamation_id)
# d["amalgamatedInto"] = amalgamation.json()
# else:
# d["stateFiling"] = f"{base_url}/{self.identifier}/filings/{self.state_filing_id}"
d["stateFiling"] = f"{base_url}/{self.identifier}/filings/{self.state_filing_id}"

if self.start_date:
d["startDate"] = LegislationDatetime.format_as_legislation_date(self.start_date)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_documents(identifier: str, filing_id: int, legal_filing_name: str = None
HTTPStatus.NOT_FOUND,
)

if not (filing := Filing.get(identifier, filing_id)):
if not (filing := Filing.get(identifier, business, filing_id)):
return (
jsonify(
message=get_error_message(
Expand Down

0 comments on commit bfb2ec0

Please sign in to comment.