diff --git a/utils/basic/morale.py b/utils/basic/morale.py index ae7b3a31..31c3c47d 100644 --- a/utils/basic/morale.py +++ b/utils/basic/morale.py @@ -72,8 +72,7 @@ def generate_morale_dict(outline: Outline) -> defaultdict[tuple[str, str], int]: if morale < 0.5: target_player_time_played = now - target.player_created_at morale += target_player_time_played.days / 500 - if morale > 0.5: - morale = 0.5 + morale = min(morale, 0.5) morale = round(morale * 100) if morale >= 100: diff --git a/utils/basic/pdf.py b/utils/basic/pdf.py index b28c25ce..9f958389 100644 --- a/utils/basic/pdf.py +++ b/utils/basic/pdf.py @@ -14,9 +14,8 @@ # ============================================================================== import secrets -from datetime import datetime +from datetime import UTC, datetime -import pytz from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models.query import QuerySet @@ -55,7 +54,7 @@ def footer(self): def generate_pdf_summary(request: HttpRequest): years_result: dict[int, dict[str, float]] = {} - current_datetime = datetime(2021, 1, 1).replace(tzinfo=pytz.UTC) + current_datetime = datetime(2021, 1, 1).replace(tzinfo=UTC) delta = relativedelta(months=1) now = timezone.now() host = request.get_host()