From a0191d146e821c75036fdc4a2b193e0bbbadcdda Mon Sep 17 00:00:00 2001 From: Dmitrii Morozov Date: Fri, 21 Jun 2024 17:19:47 +0200 Subject: Fixed error on formatting stats difference if its negative --- formatter/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/formatter/__init__.py b/formatter/__init__.py index c8e4e5c..edc1aa9 100644 --- a/formatter/__init__.py +++ b/formatter/__init__.py @@ -66,7 +66,8 @@ def __format_stats_difference(old_user_stats: UserStats, new_user_stats: UserSta def __format_stat_difference(old_stat_value: int, new_stat_value: int): if old_stat_value != new_stat_value: - return " \(\+ {}\)".format(str(new_stat_value - old_stat_value)) + difference = max(0, new_stat_value - old_stat_value) + return " \(\+ {}\)".format(str(difference)) else: return "" -- cgit v1.2.3