Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRC-507: Address phones bug on get organisation. #16

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

timharrison-moj
Copy link
Contributor

@timharrison-moj timharrison-moj commented Mar 3, 2025

Fixes a bug where all addresses included the phone numbers for all other addresses in this organisation.
The mapping between organisation address phones and organisation phones was not quite strict enough.

I am now thinking that the simpler, and clearer, solution for address-phones is to hold them separately (for both contacts and organisations) from global phones. So we'd have organisation-global-phones and organisation-address-phones as distinct tables, each containing the phone-type, phone-number and ext-number, plus the audit columns. The problem at the moment is that there is no simple way to get JUST the global phone numbers, as to do so, we need to get all phone numbers and then filter out the address-specific phone numbers, which leads to complexity and lack of clarity in the code, which I think is unnecessary.

@@ -101,6 +101,19 @@ class GetOrganisationByOrganisationIdIntegrationTest : SecureApiIntegrationTestB
).setCreatedAndModified(),
),
).setCreatedAndModified(),
MigrateOrganisationAddress(

Choose a reason for hiding this comment

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

It looks like there is very weak unit tests for OrganisationService, Would be worth if the unit tests were strong and test all possible cases there, I think it may be easy to test it as part of integration tests, Here we test the get method indirectly by using get call as part of integration tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a bug ticket - so a fix was required. I wanted to reproduce the error, which I did by adding a second address to this integration test. Initially this failed, because the single address phone number - linked to only one address - was showing up on both addresses. I then fixed the code until the test passed. I take your point about the organisation service not having lots of unit tests though, but its something to take forward on another ticket I think?

@timharrison-moj timharrison-moj merged commit 555b8f8 into main Mar 4, 2025
8 checks passed
@timharrison-moj timharrison-moj deleted the PRC-507_address_phones_bug branch March 4, 2025 10:52
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.

2 participants