256764: Implement unique field management for households and individu…#356
Open
arsen-vs wants to merge 8 commits into
Open
256764: Implement unique field management for households and individu…#356arsen-vs wants to merge 8 commits into
arsen-vs wants to merge 8 commits into
Conversation
431e8bc to
821b7a3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #356 +/- ##
===========================================
+ Coverage 96.93% 96.95% +0.01%
===========================================
Files 237 237
Lines 9798 10007 +209
Branches 1092 1124 +32
===========================================
+ Hits 9498 9702 +204
- Misses 143 148 +5
Partials 157 157 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8bc4202 to
3af6885
Compare
Contributor
|
@arsen-vs to resolve conflicts and reimplement |
added 7 commits
June 5, 2026 10:11
…als in program - Added functionality to set and manage unique fields for Household and Individual models within the Program class. - Introduced methods to save and retrieve unique field values, ensuring that archived values are properly handled during validation. - Enhanced the admin interface to allow users to set unique fields for both Household and Individual models. - Updated validation logic to check for uniqueness against both current and archived values, improving data integrity. - Added tests to verify the correct behavior of unique field management and validation processes.
- Updated the `has_any_data` method in the Program model to check for associated Batch objects instead of households or individuals. - Added tests to verify the behavior of `has_any_data` for both saved and unsaved Program instances. - Introduced additional tests for managing unique fields, ensuring proper handling of unique values and their removal in the Program model. - Improved test coverage for unique field management methods, confirming expected behavior when unique fields are absent.
- Updated the `has_any_data` method in the Program model to filter Batch objects using `program_id` for improved accuracy. - Added a new test for `has_any_data` to verify behavior with proxy instances of the Program model. - Introduced a test for the `archive_removed_unique_values` function to ensure proper handling of unique values during data archiving. - Enhanced existing tests for validation of unique fields in households, confirming that duplicates are correctly marked as invalid.
…rage - Refactored the `archive_removed_unique_values` function to better handle unique field values for both households and individuals, ensuring correct persistence during data archiving. - Updated tests to cover various scenarios for archiving unique values, including cases with no records and configurations. - Improved the integration of the `selection_owner_for_rdp` function to streamline data retrieval for archiving processes.
… processes - Added tests to ensure proper handling of unique values, including scenarios for skipping empty values and handling non-list types. - Improved validation logic for unique fields in both the Program model and workspace actions, ensuring accurate error handling and state management. - Introduced new test cases for the orchestration of unique values, enhancing overall test coverage and reliability.
3af6885 to
065c149
Compare
…for unique duplicates - Introduced a dictionary to track household members by their primary keys during validation, improving the handling of unique member validation across households. - Added a new test case to ensure that households with members having duplicate unique fields are correctly marked as invalid, enhancing overall test coverage for validation scenarios.
roma-valor
requested changes
Jun 5, 2026
| def has_any_data(self) -> bool: | ||
| if not self.pk: | ||
| return False | ||
| from country_workspace.models import Batch |
Contributor
There was a problem hiding this comment.
Why not in the beginning of module?
| return normalized or None | ||
|
|
||
|
|
||
| def _append_unique_error(obj: Model, field_name: str, message: str) -> None: |
Contributor
There was a problem hiding this comment.
Each call to _append_unique_error issues an individual UPDATE query to db. Can we use bulk_update instead?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…als in program
AB#256764