Skip to content

Bug/ulitp 5394#237

Merged
grahammcvea-defra merged 8 commits into
devfrom
bug/ulitp-5394
Jun 10, 2026
Merged

Bug/ulitp 5394#237
grahammcvea-defra merged 8 commits into
devfrom
bug/ulitp-5394

Conversation

@grahammcvea-defra

Copy link
Copy Markdown
Contributor

Refactor holding selection and merge logic for SAM import

Refactored representative holding selection to prioritize SAM Holdings over Common Land using a new SelectRepresentativeHolding method. U

pdated 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 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.
@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 95% 82%
Summary 94% (16143 / 17213) 83% (2552 / 3068)

@sonarqubecloud

sonarqubecloud Bot commented Jun 10, 2026

Copy link
Copy Markdown

@grahammcvea-defra grahammcvea-defra merged commit c208544 into dev Jun 10, 2026
5 checks passed
@grahammcvea-defra grahammcvea-defra deleted the bug/ulitp-5394 branch June 10, 2026 13:39
@grahammcvea-defra grahammcvea-defra restored the bug/ulitp-5394 branch June 12, 2026 13:46
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.

3 participants