fix(fees): stricter partial match to prevent false positives like AMA/ULTRAMARE
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
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
345fc175eb
commit
93af52574d
@ -252,9 +252,14 @@ def import_fees(excel_path, target_year=None, all_years=False, dry_run=False):
|
||||
else:
|
||||
company = company_map.get(rec['name'].upper())
|
||||
if not company:
|
||||
# Try partial match
|
||||
# Try partial match — but only if Excel name is a prefix/suffix of DB name
|
||||
# (avoid "AMA" matching "ULTRAMARE")
|
||||
excel_upper = rec['name'].upper().strip()
|
||||
for key, c in company_map.items():
|
||||
if rec['name'].upper() in key or key in rec['name'].upper():
|
||||
# Excel name starts with DB name or DB name starts with Excel name
|
||||
# Minimum 4 chars to avoid false positives
|
||||
if len(excel_upper) >= 4 and len(key) >= 4:
|
||||
if key.startswith(excel_upper) or excel_upper.startswith(key):
|
||||
company = c
|
||||
break
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user