Skip to content

Bug/ulitp 5394#240

Open
grahammcvea-defra wants to merge 13 commits into
devfrom
bug/ulitp-5394
Open

Bug/ulitp 5394#240
grahammcvea-defra wants to merge 13 commits into
devfrom
bug/ulitp-5394

Conversation

@grahammcvea-defra

Copy link
Copy Markdown
Contributor

Support mapping and testing of Common Land holdings
Add Common Land scenario and expected output to SAM-to-Gold mapping. Improve handling of site type code fallback, null CphTypeIdentifier, and null search codes in CountryData. Update tests to verify Common Land mapping and set HoldingType to null.

Bartonkeys added 13 commits June 9, 2026 07:42
Refactored representative holding selection to prioritize SAM Holdings over Common Land using a new SelectRepresentativeHolding method. Updated EnrichWithCommonLandDataAsync to merge LocalAuthorityName and deduplicate AssociatedMainHoldings across all silver holdings. Adjusted FindAndUpdateMainSiteIfExists to use CPH string. Updated SamHoldingMapper to use new selection logic. Added unit tests for merging and selection behavior. Enhanced FakeDataBridgeClient test data for completeness.
Refactored site data assignment into ApplySiteData to reduce duplication in SamHoldingMapper. Updated site creation and update methods to use this helper. Added a unit test to ensure active Common Land holdings are correctly selected as representative.
Removed the unused SiteDocument? capturedFilter variable from SamHoldingImportGoldMappingStepTests to clean up the test code. No functional changes were made.
Applied .Distinct() to ProductionUsageCodeList to remove duplicate production usage codes after trimming, ensuring only unique codes are included in the mapped result.
Refactored SAM holding mapping by introducing ResolveLocationPartsAsync to handle address and communication extraction as a tuple. Replaced duplicate logic in creation and update flows, and cached IsPermanentLandHolding() result for clarity and efficiency.
Refactored SelectRepresentativeHolding from SamHoldingImportGoldMappingStep to SamHoldingMapper as an internal method. Updated references to use the new location. No changes to method logic.
SamCommonLandMapper.ToSilver is now async and supports country resolution for enriched address data. Address mapping uses resolved country identifiers and codes. SamHoldingMapper gains SelectAddressSource to prioritize common land addresses when mapping to gold. Site creation and update logic now use the prioritized address source. Unit tests updated and expanded for new async and address selection logic.
Add Common Land scenario and expected output to SAM-to-Gold mapping. Improve handling of site type code fallback, null CphTypeIdentifier, and null search codes in CountryData. Update tests to verify Common Land mapping and set HoldingType to null.
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Health
KeeperData.Api 97% 82%
KeeperData.Api.Worker 97% 96%
KeeperData.Application 98% 87%
KeeperData.Core 88% 78%
KeeperData.Infrastructure 93% 85%
KeeperData.Tests.Common 96% 82%
Summary 94% (16284 / 17350) 83% (2561 / 3076)

@sonarqubecloud

Copy link
Copy Markdown

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