Optimize PChome review queue paging
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
OoO
2026-05-24 18:31:26 +08:00
parent 5aa2412dee
commit 5d4927c119
6 changed files with 40 additions and 13 deletions

View File

@@ -39,6 +39,22 @@ def test_competitor_dashboard_hot_paths_use_latest_price_lateral_lookup():
assert "lm.rn = 1" not in body
def test_competitor_review_queue_page_uses_single_paged_total_query():
source = (ROOT / "services/competitor_intel_repository.py").read_text(encoding="utf-8")
page_body = _function_body(
source,
"_fetch_competitor_review_queue_page_uncached",
"_fetch_competitor_review_queue_uncached",
)
assert "total_rows AS" in page_body
assert "paged_rows AS" in page_body
assert "LEFT JOIN paged_rows ON TRUE" in page_body
assert "SELECT COUNT(*) AS total FROM review_rows" not in page_body
assert "rows[0].get(\"total_count\")" in page_body
assert "if row.get(\"sku\")" in page_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")