Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Related entity fixes #349

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions pupa/importers/bills.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.db.models import Q

from opencivicdata.legislative.models import (
Bill,
RelatedBill,
Expand Down Expand Up @@ -114,9 +116,12 @@ def postimport(self):
):
candidates = list(
Bill.objects.filter(
legislative_session__identifier=rb.legislative_session,
legislative_session__jurisdiction_id=self.jurisdiction_id,
identifier=rb.identifier,
Q(
legislative_session__identifier=rb.legislative_session,
legislative_session__jurisdiction_id=self.jurisdiction_id,
),
Q(identifier=rb.identifier)
| Q(other_identifiers__identifier=rb.identifier),
)
)
if len(candidates) == 1:
Expand Down
4 changes: 1 addition & 3 deletions pupa/importers/vote_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ def prepare_for_db(self, data):
date=data["start_date"],
organization_id=data["organization_id"],
)
# seen_action_ids is for ones being added in this import
# action.vote is already set if action was set on prior import
if action.id in self.seen_action_ids or hasattr(action, "vote"):
if action.id in self.seen_action_ids:
self.warning(
"can not match two VoteEvents to %s: %s", action.id, bill_action
)
Expand Down