From 0fcae295ec1a1be1f9c7a2d8084325e7fffca0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Wed, 20 Sep 2023 18:14:58 +0200 Subject: [PATCH] minor renamings --- api/advent22_api/core/config.py | 12 ++++-------- api/advent22_api/core/helpers.py | 4 ++-- api/test/test_event_dates.py | 10 +++++----- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/api/advent22_api/core/config.py b/api/advent22_api/core/config.py index 128225c..3039d78 100644 --- a/api/advent22_api/core/config.py +++ b/api/advent22_api/core/config.py @@ -17,15 +17,15 @@ class Server(BaseModel): # Tag, an dem der Kalender startet # TODO penner - first_day: int = 1 + begin_day: int = 1 # Monat, in dem der Kalender startet # TODO penner - month: int = 12 + begin_month: int = 12 - # Alle Türen bleiben noch so viele Tage offen + # Kalender so viele Tage nach der letzten Türöffnung schließen # TODO penner - keep_open: int = 90 + close_after: int = 90 class Puzzle(BaseModel): @@ -35,10 +35,6 @@ class Puzzle(BaseModel): # Lösungswort solution: str - # Länge des Kalenders - # TODO penner - days: int = 24 - # Kalenderdefinition calendar: str = "default.toml" diff --git a/api/advent22_api/core/helpers.py b/api/advent22_api/core/helpers.py index 6ba0b87..f1a556e 100644 --- a/api/advent22_api/core/helpers.py +++ b/api/advent22_api/core/helpers.py @@ -116,10 +116,10 @@ class EventDates: # - assume sorted (ascending) events: list[int], # countdown to closing begins after last event - closing_after: int, + close_after: int, ) -> None: # account for the last event, then add closing period - self.__overall_duration = timedelta(days=events[-1] - 1 + closing_after) + self.__overall_duration = timedelta(days=events[-1] - 1 + close_after) # the events may begin last year, this year or next year maybe_begin = ( diff --git a/api/test/test_event_dates.py b/api/test/test_event_dates.py index ad55ea1..c538e84 100644 --- a/api/test/test_event_dates.py +++ b/api/test/test_event_dates.py @@ -11,7 +11,7 @@ def test_get_before(): begin_month=12, begin_day=1, events=list(range(1, 25)), - closing_after=5, + close_after=5, ) assert ed.first == date(2023, 12, 1) @@ -28,7 +28,7 @@ def test_get_after(): begin_month=12, begin_day=1, events=list(range(1, 25)), - closing_after=5, + close_after=5, ) assert ed.first == date(2024, 12, 1) @@ -45,7 +45,7 @@ def test_get_during_events(): begin_month=12, begin_day=1, events=list(range(1, 25)), - closing_after=5, + close_after=5, ) assert ed.first == date(2023, 12, 1) @@ -62,7 +62,7 @@ def test_get_during_closing(): begin_month=12, begin_day=1, events=list(range(1, 25)), - closing_after=5, + close_after=5, ) assert ed.first == date(2023, 12, 1) @@ -79,7 +79,7 @@ def test_get_during_wrap(): begin_month=12, begin_day=1, events=list(range(1, 25)), - closing_after=8, + close_after=8, ) assert ed.first == date(2023, 12, 1)