Skip to content

Commit 8a3ec87

Browse files
committed
fixes for related bills and related actions
1 parent 8087e22 commit 8a3ec87

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pupa/importers/bills.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from django.db.models import Q
2+
13
from opencivicdata.legislative.models import (Bill, RelatedBill, BillAbstract, BillTitle,
24
BillIdentifier, BillAction, BillActionRelatedEntity,
35
BillSponsorship, BillSource, BillDocument,
@@ -82,9 +84,10 @@ def postimport(self):
8284
bill__legislative_session__jurisdiction_id=self.jurisdiction_id,
8385
related_bill=None):
8486
candidates = list(Bill.objects.filter(
85-
legislative_session__identifier=rb.legislative_session,
86-
legislative_session__jurisdiction_id=self.jurisdiction_id,
87-
identifier=rb.identifier)
87+
Q(legislative_session__identifier=rb.legislative_session,
88+
legislative_session__jurisdiction_id=self.jurisdiction_id),
89+
Q(identifier=rb.identifier) |
90+
Q(other_identifiers__identifier=rb.identifier))
8891
)
8992
if len(candidates) == 1:
9093
rb.related_bill = candidates[0]

pupa/importers/vote_events.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ def prepare_for_db(self, data):
8484
organization_id=data['organization_id'],
8585
)
8686
# seen_action_ids is for ones being added in this import
87-
# action.vote is already set if action was set on prior import
88-
if action.id in self.seen_action_ids or hasattr(action, 'vote'):
87+
if action.id in self.seen_action_ids:
8988
self.warning('can not match two VoteEvents to %s: %s',
9089
action.id, bill_action)
9190
else:

0 commit comments

Comments
 (0)