refactor: change backup_orders to use cutoff param instead of start/end

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 23:02:18 +08:00
parent fac909ca8b
commit e0eff89e8c
2 changed files with 30 additions and 5 deletions

View File

@@ -9,8 +9,7 @@ from order_bak.csv_utils import CSV_COLUMNS, entity_to_row, parse_row
def backup_orders(
scan_path: Path,
backup_dir: Path,
start: datetime,
end: datetime,
cutoff: datetime,
) -> int:
backup_dir.mkdir(parents=True, exist_ok=True)
@@ -25,7 +24,7 @@ def backup_orders(
order_time = entity["OrderTime"]
if order_time is None:
continue
if order_time < start or order_time >= end:
if order_time >= cutoff:
continue
date_key = order_time.strftime("%Y-%m-%d")
by_date[date_key].append(entity)