mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-15 22:14:15 +02:00
Update helper to handle None in is_election_board
This commit is contained in:
parent
bf1d3f1ad7
commit
a74e0beb6f
1 changed files with 3 additions and 1 deletions
|
@ -240,7 +240,7 @@ class CreateOrUpdateOrganizationTypeHelper:
|
||||||
is_election_type = "_election" in organization_type
|
is_election_type = "_election" in organization_type
|
||||||
can_have_election_board = organization_type in self.generic_org_to_org_map
|
can_have_election_board = organization_type in self.generic_org_to_org_map
|
||||||
|
|
||||||
election_board_mismatch = (is_election_type != self.instance.is_election_board) and can_have_election_board
|
election_board_mismatch = (is_election_type and (not self.instance.is_election_board or self.instance.is_election_board == None)) and can_have_election_board
|
||||||
org_type_mismatch = mapped_org_type is not None and (generic_org_type != mapped_org_type)
|
org_type_mismatch = mapped_org_type is not None and (generic_org_type != mapped_org_type)
|
||||||
if election_board_mismatch or org_type_mismatch:
|
if election_board_mismatch or org_type_mismatch:
|
||||||
message = (
|
message = (
|
||||||
|
@ -248,6 +248,8 @@ class CreateOrUpdateOrganizationTypeHelper:
|
||||||
"when generic_org_type ({}), is_election_board ({}), and organization_type ({}) values do not match."
|
"when generic_org_type ({}), is_election_board ({}), and organization_type ({}) values do not match."
|
||||||
.format(generic_org_type, self.instance.is_election_board, organization_type)
|
.format(generic_org_type, self.instance.is_election_board, organization_type)
|
||||||
)
|
)
|
||||||
|
message = "Mismatch on election board, {}".format(message) if election_board_mismatch else message
|
||||||
|
message = "Mistmatch on org type, {}".format(message) if org_type_mismatch else message
|
||||||
logger.error("_validate_new_instance: %s", message)
|
logger.error("_validate_new_instance: %s", message)
|
||||||
raise ValueError(message)
|
raise ValueError(message)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue