|
@@ -8,6 +8,7 @@ from sqlalchemy import and_, exists, func, or_
|
|
|
from sqlalchemy.orm import Session
|
|
from sqlalchemy.orm import Session
|
|
|
|
|
|
|
|
from app.core.db_collation import eq_unicode
|
|
from app.core.db_collation import eq_unicode
|
|
|
|
|
+from app.core.protocol_status_display import INACTIVE_PROTOCOL_STATUSES
|
|
|
from app.core.utils import generate_uuid
|
|
from app.core.utils import generate_uuid
|
|
|
from app.utils.sample_special import sample_special_to_dict
|
|
from app.utils.sample_special import sample_special_to_dict
|
|
|
from app.models.models import (
|
|
from app.models.models import (
|
|
@@ -160,6 +161,20 @@ def normalize_ready_for_review_only(raw) -> Optional[bool]:
|
|
|
return None
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def is_inactive_protocol_status_for_hide(status) -> bool:
|
|
|
|
|
+ """True when protocol/donation status is yzf or sdfq (list-hide rule)."""
|
|
|
|
|
+ code = (status or "").strip().lower()
|
|
|
|
|
+ return code in INACTIVE_PROTOCOL_STATUSES
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def inbound_work_orders_all_void(statuses) -> bool:
|
|
|
|
|
+ """True when there is ≥1 non-empty status and every one equals yzf."""
|
|
|
|
|
+ cleaned = [(s or "").strip() for s in (statuses or [])]
|
|
|
|
|
+ if not cleaned or not any(s for s in cleaned):
|
|
|
|
|
+ return False
|
|
|
|
|
+ return all(s.lower() == "yzf" for s in cleaned)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def _qc_work_order_exists_for_review_sample(
|
|
def _qc_work_order_exists_for_review_sample(
|
|
|
tenant_no: str, *, unfinished_only: bool = False
|
|
tenant_no: str, *, unfinished_only: bool = False
|
|
|
):
|
|
):
|