Properly report gains and losses
This commit is contained in:
parent
54c49727dc
commit
a8f5ae145a
1 changed files with 9 additions and 1 deletions
|
@ -113,7 +113,15 @@ class ElectionCog(commands.Cog):
|
|||
try:
|
||||
party, extra = span.get_text().strip().split(":", 1)
|
||||
seats, extra = extra.split(",", 1)
|
||||
seats = change = int(seats.split()[0])
|
||||
extra = extra.strip()
|
||||
if extra.lower() == "no change":
|
||||
change = 0
|
||||
else:
|
||||
_values = extra.split()
|
||||
change = int(_values[0])
|
||||
if _values[-1] != "gained":
|
||||
change *= -1
|
||||
seats = int(seats.split()[0])
|
||||
except ValueError:
|
||||
self.log.error("failed to parse %r", span)
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue