From 255140224b74f80cec987837b262d926d3dc2574 Mon Sep 17 00:00:00 2001 From: OoO Date: Wed, 20 May 2026 14:55:32 +0800 Subject: [PATCH] =?UTF-8?q?[V10.336]=20=E9=81=BF=E5=85=8D=20PChome=20?= =?UTF-8?q?=E4=BD=8E=E4=BF=A1=E5=BF=83=E9=87=8D=E8=A9=95=E7=A9=BA=E8=BD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 2 +- services/competitor_price_feeder.py | 3 ++- tests/test_competitor_match_attempts_persistence.py | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 4af757d..2f2f4ed 100644 --- a/config.py +++ b/config.py @@ -320,7 +320,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '') # ========================================== # 系統版本與路徑 # ========================================== -SYSTEM_VERSION = "V10.335" +SYSTEM_VERSION = "V10.336" LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log') public_url = PUBLIC_URL # 用於模板顯示 diff --git a/services/competitor_price_feeder.py b/services/competitor_price_feeder.py index 0f8412a..646dac9 100644 --- a/services/competitor_price_feeder.py +++ b/services/competitor_price_feeder.py @@ -679,6 +679,7 @@ class CompetitorPriceFeeder: 這條路徑不重新搜尋,只用前次留下的 PChome product_id 批次查詢最新商品資料, 適合把舊 scorer 卡在 0.70~0.759 的真同款重新推進正式比價。 + 已重評後仍不足門檻的 refresh_low_score 不再重複進隊列,避免排程空轉。 """ if self.engine is None: raise RuntimeError("需要注入 SQLAlchemy engine") @@ -733,7 +734,7 @@ class CompetitorPriceFeeder: AND COALESCE(cp.tags, '[]'::jsonb) ? 'identity_v2' WHERE lm.rn = 1 AND cp.sku IS NULL - AND la.attempt_status IN ('low_score', 'refresh_low_score') + AND la.attempt_status = 'low_score' AND COALESCE(la.best_match_score, 0) >= :min_score AND COALESCE(la.hard_veto, false) = false ORDER BY la.best_match_score DESC NULLS LAST, lm.momo_price DESC NULLS LAST, lm.sku diff --git a/tests/test_competitor_match_attempts_persistence.py b/tests/test_competitor_match_attempts_persistence.py index f2381fc..8a2c87f 100644 --- a/tests/test_competitor_match_attempts_persistence.py +++ b/tests/test_competitor_match_attempts_persistence.py @@ -31,6 +31,11 @@ def test_competitor_feeder_persists_all_match_attempt_outcomes(): assert "run_expired_identity_refresh" in source assert "_fetch_retryable_candidate_skus" in source assert "run_retryable_candidate_revalidation" in source + retryable_source = source.split("def _fetch_retryable_candidate_skus", 1)[1].split( + "def _fetch_expired_identity_skus", 1 + )[0] + assert "la.attempt_status = 'low_score'" in retryable_source + assert "refresh_low_score')" not in retryable_source assert "refresh_known_identity" in source assert 'attempt_status="unit_comparable"' in source assert 'attempt_status="refresh_unit_comparable"' in source