simplify current year implementation
This commit is contained in:
@@ -3,7 +3,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from playwright.sync_api import sync_playwright, Page, BrowserContext
|
from playwright.sync_api import sync_playwright, Page, BrowserContext
|
||||||
@@ -370,12 +369,10 @@ def download_all_invoices() -> list[Path]:
|
|||||||
|
|
||||||
years = get_year_options(page)
|
years = get_year_options(page)
|
||||||
if not years:
|
if not years:
|
||||||
years = ["all"]
|
raise RuntimeError("No years found on billing page.")
|
||||||
else:
|
download_all_years = os.getenv("DOWNLOAD_ALL_YEARS", "").lower() in ("1", "true", "yes", "y")
|
||||||
download_all_years = os.getenv("DOWNLOAD_ALL_YEARS", "").lower() in ("1", "true", "yes", "y")
|
if not download_all_years:
|
||||||
if not download_all_years:
|
years = [years[0]]
|
||||||
current_year = str(datetime.now().year)
|
|
||||||
years = [current_year] if current_year in years else years[:1]
|
|
||||||
logger.info("Group '%s' - years: %s", group["label"], years)
|
logger.info("Group '%s' - years: %s", group["label"], years)
|
||||||
|
|
||||||
for year in years:
|
for year in years:
|
||||||
|
|||||||
Reference in New Issue
Block a user