fix: Map portal role codes to Polish labels in chatbot context
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

MANAGER/EMPLOYEE/VIEWER are portal permission levels, not job titles.
Rename field to portal_role with labels: administrator profilu, pracownik,
obserwator — so chatbot doesn't misinterpret them as company positions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-02-18 12:41:54 +01:00
parent a89cec2779
commit 6df36f97e8

View File

@ -578,10 +578,12 @@ class NordaBizChatEngine:
company_profile = f"https://nordabiznes.pl/company/{u.company.slug}" if u.company and u.company.slug else None
if company_name not in users_by_company:
users_by_company[company_name] = {'profile': company_profile, 'users': []}
# Map portal role codes to human-readable Polish labels
role_labels = {'MANAGER': 'administrator profilu', 'EMPLOYEE': 'pracownik', 'VIEWER': 'obserwator'}
users_by_company[company_name]['users'].append({
'name': u.name,
'email': u.email,
'role': u.company_role if u.company_role != 'NONE' else '',
'portal_role': role_labels.get(u.company_role, ''),
'member': u.is_norda_member,
'verified': u.is_verified
})