fix(audit-ai): Fix CompanyService.name AttributeError in content generation
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

company.services returns CompanyService join table objects, not Service
objects. Access service name via s.service.name relationship.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-02-07 12:51:06 +01:00
parent 7383ec74a5
commit 44e7e1cb07

View File

@ -731,7 +731,7 @@ def generate_content(company_id: int, action_type: str, context: dict = None, us
'phone': company.phone or '',
'email': company.email or '',
'address': f"{company.address_street or ''}, {company.address_city or ''}".strip(', '),
'services': ', '.join([s.name for s in company.services[:5]]) if hasattr(company, 'services') and company.services else 'brak danych',
'services': ', '.join([s.service.name for s in company.services[:5] if s.service]) if hasattr(company, 'services') and company.services else 'brak danych',
}
# Merge in extra context