From fb573cd1ac5e115cc50e66a6dd2a62195e0c080f Mon Sep 17 00:00:00 2001 From: luke11brown <13762210+luke11brown@users.noreply.github.com> Date: Fri, 26 Jan 2024 10:48:26 +0400 Subject: [PATCH] why --- .github/workflows/auto_airac_actions.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/auto_airac_actions.py b/.github/workflows/auto_airac_actions.py index dbcd87dd5..bc5e7e03f 100644 --- a/.github/workflows/auto_airac_actions.py +++ b/.github/workflows/auto_airac_actions.py @@ -49,20 +49,19 @@ def initialise(self, date_in=None) -> int: def current_cycle(self) -> str: """Return the date of the current AIRAC cycle""" def cycle(sub=0): - number_of_cycles = self.initialise() - sub - number_of_days = number_of_cycles * self.cycle_days + 1 - current_cycle = self.base_date + datetime.timedelta(days=number_of_days) - return current_cycle - - current_cycle = cycle() - if current_cycle > self.today_date: - current_cycle = cycle(sub=1) + number_of_cycles = self.initialise() - sub + number_of_days = number_of_cycles * self.cycle_days + 1 + current_cycle = self.base_date + datetime.timedelta(days=number_of_days) + return current_cycle + + current_cycle = cycle() + if current_cycle > self.today_date: + current_cycle = cycle(sub=1) - # Format month with leading zero if necessary - month_part = str(current_cycle.month).zfill(2) # Zero padding for single-digit months - - return f"{current_cycle.year}_{month_part}" + # Format month with leading zero if necessary + month_part = str(current_cycle.month).zfill(2) # Zero padding for single-digit months + return f"{current_cycle.year}_{month_part}" def current_tag(self) -> str: