Start PChome review queue from latest attempts
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s

This commit is contained in:
OoO
2026-05-24 18:52:57 +08:00
parent f950c28169
commit 82b5616921
6 changed files with 49 additions and 42 deletions

View File

@@ -55,6 +55,22 @@ def test_competitor_review_queue_page_uses_single_paged_total_query():
assert "if row.get(\"sku\")" in page_body
def test_competitor_review_queue_starts_from_latest_attempts_not_all_products():
source = (ROOT / "services/competitor_intel_repository.py").read_text(encoding="utf-8")
review_cte_body = _function_body(
source,
"_review_queue_cte_and_filter",
"_fetch_competitor_review_queue_page_uncached",
)
assert "FROM latest_attempt la" in review_cte_body
assert "JOIN products p" in review_cte_body
assert "JOIN LATERAL" in review_cte_body
assert "NOT EXISTS (" in review_cte_body
assert "FROM latest_momo lm" not in review_cte_body
assert "valid_competitor AS" not in review_cte_body
def test_competitor_feeder_persists_all_match_attempt_outcomes():
source = (ROOT / "services/competitor_price_feeder.py").read_text(encoding="utf-8")
migration = (ROOT / "migrations/023_competitor_match_attempts.sql").read_text(encoding="utf-8")