Skip to content

Commit

Permalink
Merge pull request #92 from z3c0/test (v0.9.49)
Browse files Browse the repository at this point in the history
v0.9.49
  • Loading branch information
z3c0 authored Oct 20, 2020
2 parents 6bb9f3d + f2d90a7 commit 3a4087a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ name: integration-tests

on:
pull_request:
branches:
- master
paths:
- "vistos/*"
- setup.py
- requirements.txt
branches:
- master

jobs:
run-integration-tests:
Expand Down
2 changes: 1 addition & 1 deletion vistos/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.48
0.9.49
25 changes: 18 additions & 7 deletions vistos/src/gpo/govinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,36 @@ def _get_cdir_for_member(api_key: str, bioguide_member: BioguideMemberRecord) \
-> Optional[GovInfoMemberRecord]:
"""Returns the biography data for the given BioguideMemberRecord"""

current_congress = util.get_current_congress_number()

# if a member dies in office, they will not be in the CDIR
# for that term
terms = bioguide_member.terms
if bioguide_member.death_year is not None:
terms = [term for term in bioguide_member.terms
if term.end_year < int(bioguide_member.death_year)]
else:
terms = bioguide_member.terms
try:
terms = [term for term in bioguide_member.terms
if term.end_year < int(bioguide_member.death_year)]
except ValueError:
# Death year may not be an int (1885c or Unknown).
# If it's not an int, than it's unknown
# and can't be relied on.
# If their death year is far enough back
# to be unknown, then they likely do not
# have govinfo data, so no harm done
pass

if len(terms) == 0:
# if all terms were excluded by the prior step, then
# they died in their first term and they wouldn't
# have govinfo anyways
# have govinfo anyways, so exit returning None
return None

current_congress = util.get_current_congress_number()
# govinfo doesn't have the CDIR of the current congress, so exclude it
last_term = max(terms, key=lambda t: int(t.congress_number)
if t.congress_number != current_congress else -1)

if not _cdir_exists(api_key, last_term.congress_number):
# if the last term doesn't have data, then none of the preceding
# terms can be expected to have data either, so exit returning None
return None

packages = \
Expand Down

0 comments on commit 3a4087a

Please sign in to comment.