Keep exact counts for filtered PChome reviews

This commit is contained in:
OoO
2026-05-24 21:03:02 +08:00
parent 0709392d9d
commit 0fff09a15c
6 changed files with 12 additions and 4 deletions

View File

@@ -4,6 +4,7 @@
================================================================================
【已完成】
- V10.449 修正 PChome 覆核 exact count 條件:只有預設「全部覆核、無搜尋、無分類」頁跳過 exact count只要有搜尋詞、分類篩選或單一 review status就保留精準總數避免分頁資訊失準。
- V10.448 讓 PChome 覆核「全部」頁跳過 exact count`review_status=all` 使用 shared overview cache 的待處理總數作為分頁總數提示,只查當頁 50 筆;單一狀態分流仍保留 exact count降低全量覆核頁互動成本。
- V10.447 反轉 PChome 覆核頁查詢方向review queue page 先從最新 `competitor_match_attempts` 的可覆核狀態縮小候選,再 join ACTIVE 商品與最新價,並用 `NOT EXISTS` 排除已有有效 identity_v2 正式價;避免每次「全部覆核」先掃全站 ACTIVE 商品。
- V10.446 修正 PChome 覆核頁輕量路徑的 overview timeout覆核頁總覽改讀已存在的 shared dashboard cache / stale cache沒有快取時只用目前覆核頁資料補足狀態不再現場跑 `_load_competitor_decision_overview(session)` 的重型後備 SQL。

View File

@@ -325,7 +325,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
# ==========================================
# 系統版本與路徑
# ==========================================
SYSTEM_VERSION = "V10.448"
SYSTEM_VERSION = "V10.449"
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
public_url = PUBLIC_URL # 用於模板顯示

View File

@@ -2,7 +2,7 @@
> **最後更新**: 2026-05-24 (台北時間)
> **狀態**: 🟢 四 AI Agent 自動化閉環已落地LLM 路由紅線升級為 Ollama-first 三主機級聯Gemini 備援預設關閉
> **適用版本**: V10.448
> **適用版本**: V10.449
---

View File

@@ -13,6 +13,7 @@
## 📅 詳細更新日誌 (考古存檔)
### 2026-05-24PChome 近門檻身份回收第二輪
- **V10.449 PChome 覆核 exact count 條件修正**: 只有預設「全部覆核、無搜尋、無分類」頁跳過 exact count若使用搜尋詞、分類篩選或單一 review status仍保留精準總數避免操作員分頁資訊失準。
- **V10.448 PChome 覆核全量頁跳過 exact count**: `review_status=all` 改用 shared overview cache 的待處理總數作為分頁總數提示,當頁只查 50 筆;單一狀態分流仍保留 exact count避免每次操作全量覆核頁都為總筆數重掃整個 review queue。
- **V10.447 PChome 覆核頁查詢方向反轉**: review queue page 改由最新 `competitor_match_attempts` 的可覆核狀態先縮小候選,再 join ACTIVE 商品與最新價,並用 `NOT EXISTS` 排除已有有效 `identity_v2` 正式 PChome 價格;避免「全部覆核」每次先掃全站 ACTIVE 商品後才過濾,提高核心比價覆核頁可操作性。
- **V10.446 PChome 覆核頁 overview timeout 修正**: 覆核頁輕量 render path 的總覽改讀既有 shared dashboard cache / stale cache若快取不存在只用目前覆核頁資料補足 review count 與狀態分流,不再即時呼叫 `_load_competitor_decision_overview(session)` 的重型 SQL避免正式資料量下 statement timeout。

View File

@@ -1711,7 +1711,11 @@ def _render_pchome_review_dashboard(
0,
review_status,
)
count_total = review_status != 'all'
count_total = (
review_status != 'all'
or bool(search_query)
or bool(_normalize_dashboard_category_filter(category_filter))
)
review_page = _load_competitor_review_page(
session,
page=page,

View File

@@ -138,7 +138,9 @@ def test_dashboard_v2_is_production_default_and_uses_real_dashboard_data():
assert "_build_review_dashboard_items(session, review_queue, today_start_db)" in route_source
assert "_load_cached_competitor_overview_for_review(" in route_source
assert "_load_competitor_decision_overview(session)" not in route_source
assert "count_total = review_status != 'all'" in route_source
assert "review_status != 'all'" in route_source
assert "or bool(search_query)" in route_source
assert "or bool(_normalize_dashboard_category_filter(category_filter))" in route_source
assert "count_total=count_total" in route_source
assert "只替 PChome 覆核當頁建立商品列" in route_source
assert "_load_competitor_decision_overview(session, unique_items)" in route_source