OoO 8fefea05da
All checks were successful
CD Pipeline / deploy (push) Successful in 1m6s
fix(daily_sales): 啟用 bp 版改進邏輯 + import 後跨 worker 清 cache,根除 #24 隱形 bug
- 從 app.py 刪除 396 行的 /daily_sales、/daily_sales/export、/daily_sales/export_marketing
  三條 @app.route(行 5911-6306),讓 routes/daily_sales_routes.py 的 daily_sales_bp
  生效(first-registered wins,原 app.py 版本 shadow 了 bp)。
- bp 版改進點:_is_cache_valid() 帶 5 分鐘 TTL、/api/daily_sales/clear_cache 端點、
  完整模板參數(datetime_now / active_page)。
- services/import_service.py process_daily_sales_import return True 前,
  新增跨 gunicorn worker 清 daily_sales cache 邏輯:依 GUNICORN_WORKERS 次數呼叫
  internal /api/daily_sales/clear_cache,避免 4 worker 各持 5 分鐘舊快取
  導致「匯入 15323 筆但當日業績看不到」隱形 bug。

[P7-COMPLETION]
- 方案正確: 雙重佐證(refactor-specialist + web-researcher)確認 Flask first-registered
  wins,刪 app.py 內 route 即可讓 bp 接管;helper 函式(preprocess_daily_sales_data 等)
  為 dead code 但保守保留不影響執行。
- 影響完整: 全 repo grep 確認 _SALES_PROCESSED_CACHE 在 app.py 仍有 30+ 處使用
  (sales_analysis 等其他路由),未動到;helper 函式無外部 caller。
- Regression 風險: 低,bp 版簽名與行為相容;新 cache 清除走 internal HTTP 帶 try/except
  不影響主流程;若 GUNICORN_WORKERS 未設則默認 4 與生產一致。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 21:18:17 +08:00
Description
EwoooC — 商品看板 + 業績報表 + AI KM (Flask + pgvector, Docker Compose on 188)
37 MiB
Languages
PostScript 59.7%
Python 30.9%
HTML 4.2%
CSS 2.1%
JavaScript 1.9%
Other 1.1%