From b5458b69fc21391661c7e80c4ded8abde4c4d193 Mon Sep 17 00:00:00 2001 From: Maciej Pienczyn Date: Fri, 20 Feb 2026 13:41:57 +0100 Subject: [PATCH] fix: map KRS contact data (website, email) during enrichment KRS API returns kontakt_krs with www and email fields. These were not being mapped to Company.website and Company.email. Now enrichment extracts these and normalizes the URL (adds https:// prefix, lowercase). Co-Authored-By: Claude Opus 4.6 --- blueprints/admin/routes_membership.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/blueprints/admin/routes_membership.py b/blueprints/admin/routes_membership.py index 7e313f4..77817ed 100644 --- a/blueprints/admin/routes_membership.py +++ b/blueprints/admin/routes_membership.py @@ -110,6 +110,16 @@ def _enrich_company_from_krs(company, db): if adres.get('kod_pocztowy') and not company.address_postal: company.address_postal = adres['kod_pocztowy'] + # Contact from KRS (www, email) + kontakt = data_dict.get('kontakt_krs', {}) + if kontakt.get('www') and not company.website: + www = kontakt['www'].strip() + if not www.lower().startswith('http'): + www = 'https://' + www.lower() + company.website = www + if kontakt.get('email') and not company.email: + company.email = kontakt['email'].lower().strip() + # Capital kapital = data_dict.get('kapital', {}) if kapital.get('zakladowy'):