Skip to content

Commit

Permalink
MP: Bills: dont try to add blank last action
Browse files Browse the repository at this point in the history
  • Loading branch information
showerst committed Dec 1, 2023
1 parent d5577ef commit 92708e7
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions scrapers/mp/bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def scrape_bill(self, session, chamber, url):
bill = self.do_action(bill, page, "Senate First Reading", "upper", "reading-1")
bill = self.do_action(bill, page, "Senate Final Reading", "upper", "reading-2")

last_action = self.get_cell_text(page, "Last Action")
last_action = self.get_cell_text(page, "Last Action").strip()
last_updated = self.get_cell_text(page, "Last Updated")

if "withdrawn" in last_action.lower():
Expand All @@ -128,34 +128,35 @@ def scrape_bill(self, session, chamber, url):
media_type="application/pdf",
)

if self.get_cell_text(
page, "Senate Committee"
) == last_action or self.get_cell_text(
page, "Senate Committee"
) == last_action.replace(
"SENATE-", ""
):
bill.add_action(
last_action,
dateutil.parser.parse(last_updated).strftime("%Y-%m-%d"),
chamber="upper",
classification="referral-committee",
)
if last_action != "":
if self.get_cell_text(
page, "Senate Committee"
) == last_action or self.get_cell_text(
page, "Senate Committee"
) == last_action.replace(
"SENATE-", ""
):
bill.add_action(
last_action,
dateutil.parser.parse(last_updated).strftime("%Y-%m-%d"),
chamber="upper",
classification="referral-committee",
)

# e.g. if "JGO" is house com, and "House-JGO" is last action
if self.get_cell_text(
page, "House Committee"
) == last_action or self.get_cell_text(
page, "House Committee"
) == last_action.replace(
"HOUSE-", ""
):
bill.add_action(
last_action,
dateutil.parser.parse(last_updated).strftime("%Y-%m-%d"),
chamber="lower",
classification="referral-committee",
)
# e.g. if "JGO" is house com, and "House-JGO" is last action
if self.get_cell_text(
page, "House Committee"
) == last_action or self.get_cell_text(
page, "House Committee"
) == last_action.replace(
"HOUSE-", ""
):
bill.add_action(
last_action,
dateutil.parser.parse(last_updated).strftime("%Y-%m-%d"),
chamber="lower",
classification="referral-committee",
)

if "duly adopted" in last_action.lower():
bill.add_action(
Expand Down

0 comments on commit 92708e7

Please sign in to comment.