Skip to content

Commit

Permalink
Bonus parsing fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
themm1 committed Aug 28, 2024
1 parent 163d2c6 commit 4b13b3e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions procyclingstats/table_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,20 +269,19 @@ def bonus(self) -> List[str]:
if not bonus:
bonus = "0:00:00"
else:
prefix = ""
if bonus[0] == "-":
prefix = "-"
bonus = bonus[1:]
bonus = bonus.replace(" ", "")
seconds = int(bonus)
minutes = seconds // 60
seconds -= minutes * 60
if seconds < 10:
seconds = f"0{seconds}"
seconds = "00"
minutes = "00"
splitted = bonus.split(":")
if len(splitted) > 1:
minutes = splitted[0]
if len(minutes) == 1:
minutes = "0" + minutes
seconds = splitted[1]
else:
seconds = str(seconds)
bonus = format_time(f"{minutes}:{seconds}")
bonus = prefix + bonus
seconds = splitted[0]
if len(seconds) == 1:
seconds = "0" + seconds
bonus = f"0:{minutes}:{seconds}"
bonuses.append(bonus)
if not bonuses:
bonuses = ["0:00:00" for _ in range(self.table_length)]
Expand Down

0 comments on commit 4b13b3e

Please sign in to comment.