From 116f649fa53c9b661264bfa37d465cca33c4451e Mon Sep 17 00:00:00 2001 From: Alex Parsons Date: Mon, 23 Dec 2024 20:24:41 +0000 Subject: [PATCH] [sp] Structure one sided divisions correctly. SP can have divisions where everyone votes the same way - so there can be just one msplist --- pyscraper/sp_2024/parse.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyscraper/sp_2024/parse.py b/pyscraper/sp_2024/parse.py index 390cd4f6..5ea23b9b 100644 --- a/pyscraper/sp_2024/parse.py +++ b/pyscraper/sp_2024/parse.py @@ -189,9 +189,11 @@ def process_raw_html(raw_html: Tag, agenda_item_url: str) -> BeautifulSoup: speaker.append(vote_div) vote_tag.decompose() - # now we want to wrap any sequential msplists tags in a division tag + # now we want to wrap any group of msplists tags in a division tag + # in the scottish parliament all the votes *can* be on one side + # and there will be just one msp list vote_tags = speaker.find_all("msplist") - if len(vote_tags) > 1: + if len(vote_tags) > 0: division_tag = soup.new_tag("division") vote_tags[0].insert_before(division_tag) for vote_tag in vote_tags: