More email SKU shenanigans, now with more TEST labels!
This commit is contained in:
@@ -7,6 +7,8 @@ for the label-creation side of this.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from app import config
|
||||
from app.status_rules import parse_status_list
|
||||
|
||||
@@ -17,6 +19,10 @@ def get_emailed_label_skus() -> set[str]:
|
||||
)
|
||||
|
||||
|
||||
def is_emailed_label_order(skus: list[str]) -> bool:
|
||||
emailed_skus = get_emailed_label_skus()
|
||||
def is_emailed_label_order(skus: list[str], emailed_skus: Optional[set] = None) -> bool:
|
||||
"""emailed_skus can be pre-fetched and passed in when checking many
|
||||
orders at once (e.g. refreshing the table), to avoid re-reading
|
||||
Settings from disk for every single order."""
|
||||
if emailed_skus is None:
|
||||
emailed_skus = get_emailed_label_skus()
|
||||
return any((sku or "").strip().lower() in emailed_skus for sku in skus or [])
|
||||
|
||||
Reference in New Issue
Block a user