Skip to content

allow null elected role for referendums#14

Merged
chris48s merged 4 commits intomainfrom
null-role
Jun 17, 2025
Merged

allow null elected role for referendums#14
chris48s merged 4 commits intomainfrom
null-role

Conversation

@chris48s
Copy link
Copy Markdown
Member

@chris48s chris48s commented Jun 17, 2025

This allows ballots to have a null value for elected_role, but only if the election type is referendum.

This solves one of the problems we have on the EC site.

@chris48s chris48s requested a review from symroe June 17, 2025 09:40
.with_post_name("Stroud")
.with_election_name("Stroud Governace Referendum")
.with_ballot_paper_id("ref.stroud.2024-11-14")
.with_election_id("parl.2024-11-14")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is confusing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops ac442bf

Comment thread response_builder/v1/models/base.py Outdated
ballot_title: str = Field()
poll_open_date: datetime.date = Field()
elected_role: str = Field()
elected_role: str = Field(default=None)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be Optional[str] to prevent type errors?

Copy link
Copy Markdown
Member Author

@chris48s chris48s Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 ced00c6

Slightly more generally: For projects like this where we are using types really extensively it would be really useful to look at using something like mypy or pylance in CI to do proper type checks

not today though

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I saw Astral have got into this space with ty too

@chris48s chris48s merged commit 22a3b57 into main Jun 17, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants