-
Notifications
You must be signed in to change notification settings - Fork 11
Feature/no role #4906
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
base: develop
Are you sure you want to change the base?
Feature/no role #4906
Conversation
3379584
to
c71a235
Compare
c71a235
to
4d38062
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4906 +/- ##
===========================================
- Coverage 86.18% 86.18% -0.01%
===========================================
Files 657 658 +1
Lines 36159 36163 +4
===========================================
+ Hits 31165 31167 +2
- Misses 4994 4996 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f303089
to
698f91d
Compare
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.
@domdinicola how about data migration IndividualRoleInHousehold
with ROLE_NO_ROLE
do we have in prod/trn/stg any records?
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.
and coverage
698f91d
to
5d930a5
Compare
"maritalStatus": SINGLE, | ||
"estimatedBirthDate": False, | ||
"relationship": RELATIONSHIP_UNKNOWN, | ||
"role": ROLE_NO_ROLE, |
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.
Same as in this PR #4894 - we need to make sure that this option is still displayed in the dropdown. We need the None
option in the dropdown to be able to create a grievance ticket for changing a role for individual primary/alternate -> No role
. (So the option to remove the role from the individual) Either by adding the None option to the role choices for frontend or adding it on frontend already. And please make sure that this kind of ticket is still creatable and removes the role correctly.
def role(self) -> str: | ||
role = self.households_and_roles.first() | ||
return role.role if role is not None else ROLE_NO_ROLE | ||
return self.households_and_roles.filter(role__in=[ROLE_PRIMARY, ROLE_ALTERNATE]).first() |
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.
You need to retrieve the .role
from the object.
role = self.households_and_roles.first()
return role.role if role else None
The same as before just different default if individual does not have any IndividualRoleInHousehold
|
||
def count_all_roles(self) -> int: | ||
return self.households_and_roles.exclude(role=ROLE_NO_ROLE).count() | ||
return self.households_and_roles.filter(role__in=[ROLE_PRIMARY, ROLE_ALTERNATE]).count() |
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 think just return self.households_and_roles.count()
since now if the IndividualRoleInHousehold obj exists, it will only have one of these two options.
Also in |
cbef36b
to
e52b7ae
Compare
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.
LGTM
@pkujawa could you check this one please?
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 don't see the previous comments addressed.
- This PR would make it impossible to remove role for individual via Grievance Ticket (PR #4968 needs to be merged first and then make sure it is possible to remove existing role as there will be no option NO_ROLE)
- Also it will be impossible to create a Targeting with filter for role=None as it is not within choices now.
- I can see there are a lot of usages of ROLE_NO_ROLE still. Is it planned to do only part now?
Like for example
def count_all_roles(self) -> int:
return self.households_and_roles.exclude(role=ROLE_NO_ROLE).count()
There are tests assigning ROLE_NO_ROLE for IndividualRoleInHousehold but it's not within choices anymore.
We return ROLE_NO_ROLE as a role if it's None. It's something we want?
def role(self) -> str:
role = self.households_and_roles.first()
return role.role if role is not None else ROLE_NO_ROLE
- My previous comment:
def handle_role
we can change
if role in (ROLE_PRIMARY, ROLE_ALTERNATE) and household
: ->if role and household:
and change typing since we will probably take None now as the change for no role.
I can see a lot of changes were removed from this PR that were cleaning the usages of ROLE_NO_ROLE. Do we plan to remove this value completely or we want to keep it in some places?
one question about grievance... do we cover every think there if we haven't yet None? |
We need to make sure that together with this PR we are able to remove existing roles without the option NO_ROLE. |
e52b7ae
to
02cb227
Compare
No description provided.