fix(enrichment): progress_cb parametresi eklendi
All checks were successful
ciromarket-backend-build-and-deploy / build (push) Successful in 2m42s

Ne yaptık:
- _enrich_report_task fonksiyonuna progress_cb=None default parametresi eklendi
- Queue worker progress_cb ile çağırıyordu ama fonksiyon kabul etmiyordu

Neden yaptık:
- Queue üzerinden oluşturulan tüm raporlarda TypeError ile enrichment fail oluyordu
- Bu yüzden sipariş/görüntülenme/sepet verileri hiç çekilemiyordu, hep 0 görünüyordu
This commit is contained in:
2026-07-23 00:05:13 +03:00
parent eba9709962
commit 2b0e83f2eb

View File

@@ -3746,11 +3746,13 @@ def _enrich_build_product_info(all_products):
return info
def _enrich_report_task(report_id: int):
def _enrich_report_task(report_id: int, progress_cb=None):
import time
db = SessionLocal()
try:
enrichment_progress[report_id] = {"status": "running", "step": "init", "done": 0, "total": 2}
if progress_cb:
progress_cb(95, "Sosyal kanıt verileri toplanıyor...")
all_products, _ = load_report_products(db, report_id)
product_ids = [p.get("id") for p in all_products if p.get("id")]
product_info = _enrich_build_product_info(all_products)
@@ -3778,6 +3780,8 @@ def _enrich_report_task(report_id: int):
# Enrichment bitti, konsolide dosya oluştur
enrichment_progress[report_id] = {"status": "running", "step": "consolidate", "done": 1, "total": 2}
if progress_cb:
progress_cb(98, "Rapor konsolide ediliyor...")
try:
from data_consolidator import build_consolidated_report, save_consolidated_report
consolidated = build_consolidated_report(report_id, db, REPORTS_DIR, social_data=soc_payload)