Fix CSV export: use correct agent_review JSON keys for RAG columns

legalAgentReview, brandAgentReview, channelBestPracticesAgentReview,
channelTechSpecsAgentReview, and leadAgentSummary are the actual keys
stored in the JSONB column — not legalAgent, brandAgent, channelAgent.*,
and leadAgent.summary which were causing empty CSV values.
This commit is contained in:
Vadym Samoilenko 2026-03-19 12:23:47 +00:00
parent 447c4b2a95
commit a304078a11

View file

@ -229,11 +229,11 @@ class CampaignRepository:
"Overall Status": row.overall_status or "",
"Version Workfront ID": row.version_workfront_id or "",
"Version Created": row.version_created_at.strftime("%Y-%m-%d %H:%M:%S") if row.version_created_at else "",
"Legal RAG": (agent_review.get("legalAgent") or {}).get("ragStatus") or "",
"Brand RAG": (agent_review.get("brandAgent") or {}).get("ragStatus") or "",
"Channel Best Practices RAG": (agent_review.get("channelAgent") or {}).get("bestPractices", {}).get("ragStatus") if agent_review.get("channelAgent") else "",
"Channel Tech Specs RAG": (agent_review.get("channelAgent") or {}).get("techSpecs", {}).get("ragStatus") if agent_review.get("channelAgent") else "",
"Lead Agent Summary": (agent_review.get("leadAgent") or {}).get("summary") or "",
"Legal RAG": (agent_review.get("legalAgentReview") or {}).get("ragStatus") or "",
"Brand RAG": (agent_review.get("brandAgentReview") or {}).get("ragStatus") or "",
"Channel Best Practices RAG": (agent_review.get("channelBestPracticesAgentReview") or {}).get("ragStatus") or "",
"Channel Tech Specs RAG": (agent_review.get("channelTechSpecsAgentReview") or {}).get("ragStatus") or "",
"Lead Agent Summary": agent_review.get("leadAgentSummary") or "",
})
return export_rows