Skip to content

Commit

Permalink
Merge pull request #2117 from DemocracyClub/remove-get_voter_id_reqs
Browse files Browse the repository at this point in the history
remove get_voter_id_requirements property
  • Loading branch information
chris48s authored Dec 10, 2024
2 parents ab5a8af + f05f47a commit ea2d62e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion wcivf/apps/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def list(self, request, *args, **kwargs):
"voting_system": VotingSystemSerializer(
postelection.voting_system
).data,
"requires_voter_id": postelection.get_voter_id_requirements,
"requires_voter_id": postelection.requires_voter_id,
"postal_voting_requirements": postelection.get_postal_voting_requirements,
"seats_contested": postelection.winner_count,
"organisation_type": postelection.post.organization_type,
Expand Down
11 changes: 0 additions & 11 deletions wcivf/apps/elections/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from django.utils.translation import gettext_lazy as _
from django_extensions.db.models import TimeStampedModel
from uk_election_ids.metadata_tools import (
IDRequirementsMatcher,
PostalVotingRequirementsMatcher,
)

Expand Down Expand Up @@ -712,16 +711,6 @@ def should_show_candidates(self):
return False
return True

@property
def get_voter_id_requirements(self):
try:
matcher = IDRequirementsMatcher(
self.ballot_paper_id, nation=self.post.territory
)
return matcher.get_id_requirements()
except Exception:
return None

@property
def get_postal_voting_requirements(self):
try:
Expand Down
2 changes: 0 additions & 2 deletions wcivf/apps/elections/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,8 @@ def test_short_cancelled_message_html(self, post_election):

def test_metadata_tools(self, db):
old_ballot = PostElectionFactory()
assert old_ballot.get_voter_id_requirements is None
assert old_ballot.get_postal_voting_requirements == "RPA2000"

newer_ballot = PostElectionFactory()
newer_ballot.ballot_paper_id = "parl.place.2025-01-01"
assert newer_ballot.get_voter_id_requirements == "EA-2022"
assert newer_ballot.get_postal_voting_requirements == "EA-2022"

0 comments on commit ea2d62e

Please sign in to comment.