Skip to content

Commit

Permalink
LA exclude "Total --" correctly
Browse files Browse the repository at this point in the history
This fixes the naming issue in la noted in openstates#1397.
  • Loading branch information
mshenfield committed Mar 15, 2017
1 parent ce86009 commit 8ffc29e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions openstates/la/bills.py
Expand Up @@ -150,7 +150,6 @@ def scrape_vote(self, bill, name, url):
os.remove(temp_path)

vote_type = None
total_re = re.compile('^Total--(\d+)$')
body = html.xpath('string(/html/body)')

date_match = re.search('Date: (\d{1,2}/\d{1,2}/\d{4})', body)
Expand All @@ -164,7 +163,8 @@ def scrape_vote(self, bill, name, url):

for line in body.replace(u'\xa0', '\n').split('\n'):
line = line.replace(' ', '').strip()
if not line:
# Skip blank lines and "Total --"
if not line or 'Total --' in line:
continue

if line in ('YEAS', 'NAYS', 'ABSENT'):
Expand All @@ -173,10 +173,7 @@ def scrape_vote(self, bill, name, url):
elif line in ('Total', '--'):
vote_type = None
elif vote_type:
match = total_re.match(line)
if match:
vote['%s_count' % vote_type] = int(match.group(1))
elif vote_type == 'yes':
if vote_type == 'yes':
vote.yes(line)
elif vote_type == 'no':
vote.no(line)
Expand Down

0 comments on commit 8ffc29e

Please sign in to comment.