Skip to content

Commit

Permalink
25405 fix_entity_description_filing_outputs (bcgov#3185)
Browse files Browse the repository at this point in the history
* 25405 fix_entity_description_filing_outputs

* clean up
  • Loading branch information
kzdev420 authored Jan 29, 2025
1 parent 48550e2 commit c37cc79
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions legal-api/src/legal_api/reports/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,21 +354,23 @@ def _set_tax_id(self, filing):

def _set_description(self, filing):
legal_type = None
if self._filing.filing_type == 'alteration':
legal_type = self._filing.filing_json.get('filing').get('alteration').get('business', {}).get('legalType')
filing_json = self._filing.filing_json.get('filing', {})
filing_type = self._filing.filing_type

# Check for alteration filing type
if filing_type == 'alteration':
legal_type = filing_json.get('alteration', {}).get('business', {}).get('legalType')
else:
legal_type = (self._filing.filing_json
.get('filing')
.get(self._filing.filing_type)
.get('nameRequest', {})
.get('legalType'))
legal_type = filing_json.get(filing_type, {}).get('nameRequest', {}).get('legalType')

# Fallback: Check the general business section
if not legal_type:
legal_type = filing_json.get('business', {}).get('legalType')

# Final fallback: Check the _business object
if not legal_type and self._business:
legal_type = self._business.legal_type

if not legal_type and self._filing.filing_type == 'noticeOfWithdrawal':
legal_type = self._filing.filing_json.get('filing').get('business', {}).get('legalType')

filing['numberedDescription'] = Business.BUSINESSES.get(legal_type, {}).get('numberedDescription')
filing['numberedLegalNameSuffix'] = Business.BUSINESSES.get(legal_type, {}).get('numberedLegalNameSuffix')

Expand Down

0 comments on commit c37cc79

Please sign in to comment.