fix: never checking archives if the current year is not in the archives

pull/860/head
Raphaël Vinot 2024-01-08 18:45:01 +01:00
parent f7c45b5039
commit 13f7394ba2
1 changed files with 4 additions and 3 deletions

View File

@ -79,11 +79,12 @@ def get_email_template() -> str:
def make_dirs_list(root_dir: Path) -> List[Path]:
directories = []
year_now = date.today().year
while True:
while year_now >= year_now - 10:
year_dir = root_dir / str(year_now)
if not year_dir.exists():
# if we do not have a directory with this year, quit the loop
break
# if we do not have a directory with this year, continue.
# If we quit, it breaks on the new year.
continue
for month in range(12, 0, -1):
month_dir = year_dir / f'{month:02}'
if month_dir.exists():