Skip to content

Commit

Permalink
Merge pull request #132 from openstates/add-chamber-vote-importer/DAT…
Browse files Browse the repository at this point in the history
…A-4909

Add chamber vote importer
  • Loading branch information
jessemortenson authored Jul 26, 2024
2 parents ac8e53a + 63c10f1 commit 7ac7b73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion openstates/cli/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def load_directory_to_database(files: list[Path], purge: bool) -> None:
click.secho(f"updated person from {filename}", fg="cyan")
updated_count += 1

if created or updated:
if (created or updated) and len(person.roles) > 0:
updated_jurisdictions.add(person.roles[0].jurisdiction)

missing_ids = existing_ids - ids
Expand Down
7 changes: 5 additions & 2 deletions openstates/importers/vote_events.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import typing
from .base import BaseImporter
from ._types import _JsonDict, _DBSpec, _RelatedModels
Expand Down Expand Up @@ -69,8 +70,9 @@ def limit_spec(self, spec: _JsonDict) -> _DBSpec:
def prepare_for_db(self, data: _JsonDict) -> _JsonDict:
session = self.get_session(data.pop("legislative_session"))
data["legislative_session_id"] = session.id
organization_classification = data.pop("organization")
data["organization_id"] = self.org_importer.resolve_json_id(
data.pop("organization")
organization_classification
)

bill = data.pop("bill")
Expand Down Expand Up @@ -117,7 +119,8 @@ def prepare_for_db(self, data: _JsonDict) -> _JsonDict:

for vote in data["votes"]:
vote["voter_id"] = self.resolve_person(
vote["voter_id"], session.start_date, session.end_date
vote["voter_id"], session.start_date, session.end_date,
json.loads(organization_classification[1:]).get("classification", None)
)
return data

Expand Down

0 comments on commit 7ac7b73

Please sign in to comment.