Skip to content

Commit

Permalink
syn with other PR
Browse files Browse the repository at this point in the history
  • Loading branch information
tshyun24 committed Apr 11, 2024
1 parent 08fa7a5 commit f73b8db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion legal-api/src/legal_api/reports/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def _set_completing_party(self, filing):
self._filing.id, datetime.utcnow(), EntityRole.RoleTypes.completing_party.name
)
if completing_party_role:
filing["completingParty"] = completing_party_role[0].json
filing["completingParty"] = completing_party_role[0].related_entity.party_json
with suppress(KeyError):
self._format_address(filing["completingParty"]["deliveryAddress"])
with suppress(KeyError):
Expand Down
6 changes: 2 additions & 4 deletions legal-api/src/legal_api/services/business_details_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,14 @@ def get_business_revision_obj(filing, business) -> any:
business_revision = business

# The history table has the old revisions, not the current one.
if business_revision and business_revision.change_filing_id != filing.id:
if business_revision and business_revision.change_filing_id > filing.id:
business_version = (
history_cls(LegalEntity) if business_revision.is_legal_entity else history_cls(AlternateName)
)

business_revision = (
db.session.query(business_version)
.filter(business_version.change_filing_id == filing.id)
.filter(business_version.change_filing_id <= filing.id)
.filter(business_version.id == business.id)
.first()
)
Expand Down Expand Up @@ -819,8 +819,6 @@ def resolution_json(resolution_revision) -> dict:
@staticmethod
def business_revision_json(business_revision, business_json):
"""Return the business revision as a json object."""
if not business_revision:
return business_json

if business_revision.is_legal_entity:
business_json["hasRestrictions"] = business_revision.restriction_ind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def get_entity_roles_by_filing(filing_id: int, end_date: datetime = None, role:
"""Return the parties that match the filter conditions."""
entity_roles = (
db.session.query(EntityRole)
.filter(EntityRole.filing_id == filing_id)
.filter(EntityRole.filing_id <= filing_id)
.filter(cast(EntityRole.appointment_date, Date) <= end_date)
.filter(
or_(
Expand Down

0 comments on commit f73b8db

Please sign in to comment.