Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Refactoring, line_is_relevant can be shared for proporz and majorz
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas committed Aug 8, 2019
1 parent 5267001 commit 622bfb2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion onegov/election_day/formats/election/wabstic_majorz.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from onegov.ballot import ElectionResult
from onegov.election_day import _
from onegov.election_day.formats.common import EXPATS, validate_column, \
line_is_relevant, validate_integer
validate_integer, line_is_relevant
from onegov.election_day.formats.common import FileImportError
from onegov.election_day.formats.common import load_csv
from sqlalchemy.orm import object_session
Expand Down
9 changes: 1 addition & 8 deletions onegov/election_day/formats/election/wabstic_proporz.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from onegov.ballot import ListConnection
from onegov.ballot import ListResult
from onegov.election_day import _
from onegov.election_day.formats.common import EXPATS
from onegov.election_day.formats.common import EXPATS, line_is_relevant
from onegov.election_day.formats.common import FileImportError
from onegov.election_day.formats.common import load_csv
from sqlalchemy.orm import object_session
Expand Down Expand Up @@ -62,13 +62,6 @@
)


def line_is_relevant(line, number, district=None):
if district:
return line.sortwahlkreis == district and line.sortgeschaeft == number
else:
return line.sortgeschaeft == number


def get_number_of_mandates(line):
col = 'sitze'
if not hasattr(line, col):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def test_import_wabstic_proporz_invalid_values(session):
('wp_gemeinden', 2,
'Invalid integer: stimmberechtigte'),
('wp_kandidaten', 2, 'Candidate with id'
' xxx not in wpstatic_candidates'),
' xxx not in wpstatic_kandidaten'),
('wp_kandidatengde', 2, 'Invalid integer: stimmen'),
('wp_listen', 2, 'Invalid integer: sitze'),
('wp_listengde', 2, 'Invalid integer: stimmentotal'),
Expand Down

0 comments on commit 622bfb2

Please sign in to comment.