Skip to content

33224: Clear out currency_additional when altering currency to valid type#4332

Merged
loneil merged 1 commit into
bcgov:mainfrom
loneil:33224clearAdditionalCurrencyWhenChanged
Apr 28, 2026
Merged

33224: Clear out currency_additional when altering currency to valid type#4332
loneil merged 1 commit into
bcgov:mainfrom
loneil:33224clearAdditionalCurrencyWhenChanged

Conversation

@loneil
Copy link
Copy Markdown
Collaborator

@loneil loneil commented Apr 27, 2026

Issue #: /bcgov/entity#33224

Description of changes:
If there's an additional currency in a share and you fix from OTHER to a valid type, remove that additional.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the lear license (Apache 2.0).

Signed-off-by: Lucas <lucasoneil@gmail.com>
Copilot AI review requested due to automatic review settings April 27, 2026 23:36
@sonarqubecloud
Copy link
Copy Markdown

@loneil loneil self-assigned this Apr 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates share class persistence/serialization to ensure currency_additional is cleared when the share class currency is set to a non-OTHER code, and exposes currencyAdditional in the versioned business details output.

Changes:

  • Clear ShareClass.currency_additional in the SQLAlchemy before_insert/before_update listener when currency != OTHER.
  • Add unit tests covering listener behavior for currency_additional handling (insert scenarios).
  • Include currencyAdditional in share_class_revision_json output (versioned business details).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
legal-api/src/legal_api/models/share_class.py Enforces clearing currency_additional when currency is not OTHER.
legal-api/src/legal_api/services/business_details_version.py Adds currencyAdditional to share class revision JSON output.
legal-api/tests/unit/models/test_share_class.py Adds listener tests for clearing/preserving currency_additional.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread legal-api/tests/unit/models/test_share_class.py
@loneil loneil requested review from argush3 and meawong April 28, 2026 05:09
Copy link
Copy Markdown
Collaborator

@meawong meawong left a comment

Choose a reason for hiding this comment

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

LGTM

@loneil loneil merged commit b134662 into bcgov:main Apr 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants