From 2b0e83f2eb1c25b9227e2900f98740abafc26e6c Mon Sep 17 00:00:00 2001 From: furkanyigit34 Date: Thu, 23 Jul 2026 00:05:13 +0300 Subject: [PATCH] fix(enrichment): progress_cb parametresi eklendi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- backend/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/main.py b/backend/main.py index 008f5ed..8bb433c 100644 --- a/backend/main.py +++ b/backend/main.py @@ -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)