fix: handle KRS financial report period format variants
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
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
KRS API returns two date formats for za_okres field: "01.01.2011 - 31.12.2011" (older) and "OD 01.01.2013 DO 31.12.2013" (newer). Use regex to extract all date patterns instead of splitting on ' - '. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cbe3cd3f6e
commit
ffd9e26d2e
@ -277,12 +277,15 @@ def _enrich_company_from_krs(company, db):
|
||||
za_okres = sf.get('za_okres', '')
|
||||
data_zlozenia = sf.get('data_zlozenia', '')
|
||||
|
||||
# Extract two dates from period string
|
||||
# Handles: "01.01.2011 - 31.12.2011" and "OD 01.01.2013 DO 31.12.2013"
|
||||
period_start = None
|
||||
period_end = None
|
||||
if ' - ' in za_okres:
|
||||
parts = za_okres.split(' - ')
|
||||
period_start = _parse_krs_date(parts[0].strip())
|
||||
period_end = _parse_krs_date(parts[1].strip())
|
||||
import re as _re
|
||||
date_matches = _re.findall(r'(\d{2}\.\d{2}\.\d{4})', za_okres)
|
||||
if len(date_matches) >= 2:
|
||||
period_start = _parse_krs_date(date_matches[0])
|
||||
period_end = _parse_krs_date(date_matches[1])
|
||||
|
||||
filed = _parse_krs_date(data_zlozenia)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user