From aeae322a4e67789839a909e508265f673c11f977 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 15 Jul 2026 09:35:19 +0000 Subject: [PATCH] =?UTF-8?q?Use=20the=20fetched=20gov=20cert=20when=20nothi?= =?UTF-8?q?ng=20is=20stored=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- applications/modelling_e2e/handler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/applications/modelling_e2e/handler.py b/applications/modelling_e2e/handler.py index 8ff4497bd..208b5ae7c 100644 --- a/applications/modelling_e2e/handler.py +++ b/applications/modelling_e2e/handler.py @@ -393,7 +393,11 @@ def _newer_lodged( """ADR-0001 Recency Tie-Break over the two lodged sources. Returns (chosen, chosen_is_fetched) — the bool gates the EPC save, so a stored EPC that wins is never re-persisted.""" - if fetched is not None and fetched.inspection_date > stored.inspection_date: + if fetched is None: + return stored, False + if stored is None: + return fetched, True + if fetched.inspection_date > stored.inspection_date: return fetched, True return stored, False