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

Investigate the incorrect usage of .add() and .set() in M2M relationships #2359

Open
1 task
Sepehr-Sobhani opened this issue Oct 11, 2024 · 0 comments
Open
1 task
Labels

Comments

@Sepehr-Sobhani
Copy link
Contributor

Describe the task

Our codebase contains instances where the .add() and .set() methods for handling M2M relationships have been used incorrectly. The .add() method is intended to append new relationships without affecting existing ones, while the .set() method replaces the entire set of relationships, removing any not included in the new list. Misusing these methods can lead to unintended data loss and inconsistencies in the relationships. We need to review the code for proper usage and refactor any incorrect implementations to ensure data integrity and maintainability.

Most instances of using .set() seem to involve assigning regulated_products or activities to an operation or reporting_operation.

  • create_or_update_operation
  • set_registration_purpose
  • save_report_operation

Acceptance Criteria

  • Ensure proper usage of .set() across the codebase and add regression tests if necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant