From 2d4c389743ff307be74af1861d6debda8bc8d194 Mon Sep 17 00:00:00 2001
From: Shaoyun Tong <144159934+tshyun24@users.noreply.github.com>
Date: Thu, 11 Apr 2024 15:34:01 -0700
Subject: [PATCH] update IA and Alternation (#2585)
---
legal-api/report-templates/incorporationApplication.html | 4 ++--
.../incorporation-application/benefitCompanyStmt.html | 2 +-
.../template-parts/incorporation-application/nameRequest.html | 2 +-
legal-api/src/legal_api/models/entity_role.py | 2 +-
legal-api/src/legal_api/reports/report.py | 2 +-
legal-api/src/legal_api/services/business_details_version.py | 3 ++-
6 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/legal-api/report-templates/incorporationApplication.html b/legal-api/report-templates/incorporationApplication.html
index b9355202a9..18ea42bde5 100644
--- a/legal-api/report-templates/incorporationApplication.html
+++ b/legal-api/report-templates/incorporationApplication.html
@@ -24,8 +24,8 @@
diff --git a/legal-api/report-templates/template-parts/incorporation-application/nameRequest.html b/legal-api/report-templates/template-parts/incorporation-application/nameRequest.html
index a6b9df3c21..8d2a7fa204 100644
--- a/legal-api/report-templates/template-parts/incorporation-application/nameRequest.html
+++ b/legal-api/report-templates/template-parts/incorporation-application/nameRequest.html
@@ -16,7 +16,7 @@
{% if not nameRequest.nrNumber %}
The company is to be incorporated with a name created by adding "{{numberedLegalNameSuffix}}" after the incorporation number.
{% else %}
- {{nameRequest.businessName}}
+ {{nameRequest.legalName}}
{% endif %}
diff --git a/legal-api/src/legal_api/models/entity_role.py b/legal-api/src/legal_api/models/entity_role.py
index c862df48c8..3f1da9271b 100644
--- a/legal-api/src/legal_api/models/entity_role.py
+++ b/legal-api/src/legal_api/models/entity_role.py
@@ -285,7 +285,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_(
diff --git a/legal-api/src/legal_api/reports/report.py b/legal-api/src/legal_api/reports/report.py
index 00b64b1785..e61a8cd111 100644
--- a/legal-api/src/legal_api/reports/report.py
+++ b/legal-api/src/legal_api/reports/report.py
@@ -677,7 +677,7 @@ def _format_alteration_data(self, filing):
filing["listOfTranslations"] = filing["alteration"].get("nameTranslations", [])
# Get previous translations for deleted translations. No record created in aliases version for deletions
filing["previousNameTranslations"] = VersionedBusinessDetailsService.get_name_translations_revision(
- self._filing.transaction_id, self._business.id
+ self._filing, self._business.id
)
if filing["alteration"].get("shareStructure", None):
filing["shareClasses"] = filing["alteration"]["shareStructure"].get("shareClasses", [])
diff --git a/legal-api/src/legal_api/services/business_details_version.py b/legal-api/src/legal_api/services/business_details_version.py
index b531a0cdff..9c80cb6507 100644
--- a/legal-api/src/legal_api/services/business_details_version.py
+++ b/legal-api/src/legal_api/services/business_details_version.py
@@ -460,8 +460,9 @@ def get_name_translations_revision(filing, legal_entity_id) -> dict:
)
name_translations_version = history_cls(AlternateName)
+ columns_to_select = [col for col in name_translations_version.__table__.columns if col.name != 'changed']
name_translations_history = (
- db.session.query(name_translations_version)
+ db.session.query(*columns_to_select)
.filter(name_translations_version.change_filing_id == filing.id)
.filter(name_translations_version.legal_entity_id == legal_entity_id)
.filter(name_translations_version.name_type == "TRANSLATION")