2026-05-08 23:07:01 +12:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
from app.models.mix_calculator import MixCalculatorSession
|
2026-05-31 20:19:44 +12:00
|
|
|
from app.schemas.mix_calculator import MixCalculatorPreviewRead
|
2026-05-08 23:07:01 +12:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def mix_calculator_pdf_filename(session_record: MixCalculatorSession) -> str:
|
|
|
|
|
raw = f"{session_record.session_number}_{session_record.client_name}_{session_record.product_name}.pdf"
|
|
|
|
|
return re.sub(r"[^\w.\-]+", "_", raw)
|
2026-05-31 20:19:44 +12:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def mix_calculator_preview_pdf_filename(preview: MixCalculatorPreviewRead) -> str:
|
|
|
|
|
raw = f"MixCalculator_{preview.client_name}_{preview.product_name}_{preview.mix_date}.pdf"
|
|
|
|
|
return re.sub(r"[^\w.\-]+", "_", raw)
|