Fix etat mapping: use only production/implementation/stock/obsolete/eol

This commit is contained in:
Pierre & Lumière 2026-04-14 13:34:07 +02:00
parent 42fb16d67e
commit f0fe6eba81

View File

@ -27,16 +27,17 @@ def norm_os_family(famille):
def norm_etat(status, etat):
s = (status or "").strip().lower()
"""Mapper vers les valeurs autorisées par le CHECK constraint:
production, implementation, stock, obsolete, eol."""
e = (etat or "").strip().lower()
if "stock" in e:
return "stock"
if s == "recette" or e == "recette":
return "recette"
if "pr" in s and "prod" in s:
return "preprod"
if "veloppement" in s:
return "dev"
if "implémentation" in e or "implementation" in e:
return "implementation"
if "obsol" in e:
return "obsolete"
if "eol" in e:
return "eol"
return "production"