From 13f7394ba2fb20ae5213561c4bbb76028cd79a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 8 Jan 2024 18:45:01 +0100 Subject: [PATCH] fix: never checking archives if the current year is not in the archives --- lookyloo/helpers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lookyloo/helpers.py b/lookyloo/helpers.py index 9dea32e5..d0259063 100644 --- a/lookyloo/helpers.py +++ b/lookyloo/helpers.py @@ -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():