Use the fetched gov cert when nothing is stored 🟩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-15 09:35:19 +00:00
parent 3a76bd0f7c
commit aeae322a4e

View file

@ -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