-
Notifications
You must be signed in to change notification settings - Fork 6
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
POLIO-1774: delete rounds without campaign #1906
base: main
Are you sure you want to change the base?
Conversation
- Add method to make sure RoundScope and associated Group are deleted as well - Add tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost LGTM.
I have a concern with the usage of signals.
which happens when a Round is deleted. | ||
""" | ||
if instance.group: | ||
instance.group.delete() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a rule of thumb with signals: use them as a last resort.
The reason is that after adding a bunch of signals, projects start to turn into knotted hairballs that can't be untangled.
Do you think it would be possible to move this either into RoundScope.delete()
or in a custom model manager method?
Otherwise, let's move it into a proper signals.py
file to make it obvious and easy to spot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try it
cls.source_version, | ||
cls.ou_type_country, | ||
cls.ou_type_district, | ||
"GROLAND", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this better than "Hydroponic gardens"? 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally, and this is a hill I'm ready to die on 😁
More seriously, the name field don't matter that much as long as the variable/property is correctly named , I think
@@ -26,7 +26,7 @@ def setUpTestData(cls): | |||
cls.now = now() | |||
cls.source_version_1 = m.SourceVersion.objects.create(data_source=cls.data_source, number=1) | |||
cls.account = polio_account = Account.objects.create(name="polio", default_version=cls.source_version_1) | |||
cls.yoda = cls.create_user_with_profile(username="yoda", account=polio_account, permissions=["iaso_forms"]) | |||
cls.user = cls.create_user_with_profile(username="yoda", account=polio_account, permissions=["iaso_forms"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Polio had rounds without campaign, which shouldn't be possible
Related JIRA tickets : POLIO-1774
Self proofreading checklist
Doc
NA
Changes
RoundScope
and associatedGroup
are deleted as well when aRound
is deletedHow to test
In the UI:
Alternately, you can check directly on the DB
Print screen / video
N/A
Follow the Conventional Commits specification
The merge message of a pull request must follow the Conventional Commits specification.
This convention helps to automatically generate release notes.
Use lowercase for consistency.
Example:
Note that the Jira reference is preceded by a line break.
Both the line break and the Jira reference are entered in the Add an optional extended description… field.