From c96d8bb0ea6e878ad5a8b971eec73a3ca8647e52 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Tue, 13 Jul 2021 16:31:57 +0200 Subject: [PATCH 4/5] to be fixed up: add comment about our heuristic when BAN id has changed --- passerelle/apps/base_adresse/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/passerelle/apps/base_adresse/models.py b/passerelle/apps/base_adresse/models.py index fc92bee4..43153dbc 100644 --- a/passerelle/apps/base_adresse/models.py +++ b/passerelle/apps/base_adresse/models.py @@ -184,6 +184,9 @@ class BaseAdresse(BaseResource): for result in results: # match by id if possible if result['ban_id'] == ban_id: return {'data': [result]} + # in the hypothetical case that the ban_id has changed, instead of + # returning an error we bet that the first result is the good one, + # at least the nearest from the one we search. return results else: # retrocompatibility with raw BAN id return {'err': _('Address ID not found')} -- 2.32.0.rc0