Update generic_helper.py

This commit is contained in:
zandercymatics 2024-04-08 20:34:53 -06:00
parent f73fe9f042
commit 9a87d24d6e
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -189,7 +189,7 @@ class CreateOrUpdateOrganizationTypeHelper:
new_org = election_org_map[current_org_type] new_org = election_org_map[current_org_type]
self.instance.generic_org_type = new_org self.instance.generic_org_type = new_org
self.instance.is_election_board = True self.instance.is_election_board = True
else: elif self.instance.generic_org_type is not None:
self.instance.generic_org_type = current_org_type self.instance.generic_org_type = current_org_type
# This basically checks if the given org type # This basically checks if the given org type
@ -207,6 +207,12 @@ class CreateOrUpdateOrganizationTypeHelper:
f"cannot exist for {current_org_type}. Setting to None." f"cannot exist for {current_org_type}. Setting to None."
) )
self.instance.is_election_board = None self.instance.is_election_board = None
else:
# if self.instance.organization_type is set to None, then this means
# we should clear the related fields.
# This will not occur if it just is None (i.e. default), only if it is set to be so.
self.instance.is_election_board = None
self.instance.generic_org_type = None
def _validate_new_instance(self): def _validate_new_instance(self):
""" """