|
@@ -14,6 +14,8 @@ from supply_infra.db.models.video_discovery import (
|
|
|
)
|
|
)
|
|
|
from supply_infra.db.session import get_session
|
|
from supply_infra.db.session import get_session
|
|
|
|
|
|
|
|
|
|
+_MIN_VISIBLE_BIZ_DT = "20260730"
|
|
|
|
|
+
|
|
|
|
|
|
|
|
def _json_value(raw: str | None) -> Any:
|
|
def _json_value(raw: str | None) -> Any:
|
|
|
if not raw:
|
|
if not raw:
|
|
@@ -207,7 +209,7 @@ def list_video_discovery_runs(
|
|
|
) -> dict[str, Any]:
|
|
) -> dict[str, Any]:
|
|
|
"""List find-agent runs with live search and candidate counts."""
|
|
"""List find-agent runs with live search and candidate counts."""
|
|
|
with get_session() as session:
|
|
with get_session() as session:
|
|
|
- conditions = []
|
|
|
|
|
|
|
+ conditions = [VideoDiscoveryRun.biz_dt >= _MIN_VISIBLE_BIZ_DT]
|
|
|
if biz_dt:
|
|
if biz_dt:
|
|
|
conditions.append(VideoDiscoveryRun.biz_dt == biz_dt)
|
|
conditions.append(VideoDiscoveryRun.biz_dt == biz_dt)
|
|
|
if status:
|
|
if status:
|
|
@@ -249,7 +251,10 @@ def list_video_discovery_runs(
|
|
|
def get_video_discovery_run(run_id: str) -> dict[str, Any] | None:
|
|
def get_video_discovery_run(run_id: str) -> dict[str, Any] | None:
|
|
|
with get_session() as session:
|
|
with get_session() as session:
|
|
|
row = session.scalar(
|
|
row = session.scalar(
|
|
|
- select(VideoDiscoveryRun).where(VideoDiscoveryRun.run_id == run_id)
|
|
|
|
|
|
|
+ select(VideoDiscoveryRun).where(
|
|
|
|
|
+ VideoDiscoveryRun.run_id == run_id,
|
|
|
|
|
+ VideoDiscoveryRun.biz_dt >= _MIN_VISIBLE_BIZ_DT,
|
|
|
|
|
+ )
|
|
|
)
|
|
)
|
|
|
if row is None:
|
|
if row is None:
|
|
|
return None
|
|
return None
|
|
@@ -266,7 +271,10 @@ def list_video_discovery_searches(
|
|
|
) -> dict[str, Any] | None:
|
|
) -> dict[str, Any] | None:
|
|
|
with get_session() as session:
|
|
with get_session() as session:
|
|
|
exists = session.scalar(
|
|
exists = session.scalar(
|
|
|
- select(VideoDiscoveryRun.id).where(VideoDiscoveryRun.run_id == run_id)
|
|
|
|
|
|
|
+ select(VideoDiscoveryRun.id).where(
|
|
|
|
|
+ VideoDiscoveryRun.run_id == run_id,
|
|
|
|
|
+ VideoDiscoveryRun.biz_dt >= _MIN_VISIBLE_BIZ_DT,
|
|
|
|
|
+ )
|
|
|
)
|
|
)
|
|
|
if exists is None:
|
|
if exists is None:
|
|
|
return None
|
|
return None
|
|
@@ -355,7 +363,10 @@ def list_video_discovery_candidates(
|
|
|
) -> dict[str, Any] | None:
|
|
) -> dict[str, Any] | None:
|
|
|
with get_session() as session:
|
|
with get_session() as session:
|
|
|
exists = session.scalar(
|
|
exists = session.scalar(
|
|
|
- select(VideoDiscoveryRun.id).where(VideoDiscoveryRun.run_id == run_id)
|
|
|
|
|
|
|
+ select(VideoDiscoveryRun.id).where(
|
|
|
|
|
+ VideoDiscoveryRun.run_id == run_id,
|
|
|
|
|
+ VideoDiscoveryRun.biz_dt >= _MIN_VISIBLE_BIZ_DT,
|
|
|
|
|
+ )
|
|
|
)
|
|
)
|
|
|
if exists is None:
|
|
if exists is None:
|
|
|
return None
|
|
return None
|