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): 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() e = (etat or "").strip().lower()
if "stock" in e: if "stock" in e:
return "stock" return "stock"
if s == "recette" or e == "recette": if "implémentation" in e or "implementation" in e:
return "recette" return "implementation"
if "pr" in s and "prod" in s: if "obsol" in e:
return "preprod" return "obsolete"
if "veloppement" in s: if "eol" in e:
return "dev" return "eol"
return "production" return "production"