diff --git a/loko/inspections/models.py b/loko/inspections/models.py
index fbc8fe6..dbf6c62 100644
--- a/loko/inspections/models.py
+++ b/loko/inspections/models.py
@@ -545,6 +545,148 @@ class GiepInspection(Inspection):
verbose_name = _("Inspection GIEP / Eaux pluviales")
verbose_name_plural = _("Inspections GIEP / Eaux pluviales")
+ @classmethod
+ def compute_status_from_data(cls, data):
+ """
+ Calcule le résultat global ('damaged', 'non_compliant', 'compliant')
+ sur base des réponses aux questions de chaque ouvrage d'une inspection GIEP.
+ Priorité : damaged > non_compliant > compliant.
+ """
+ if not data or not isinstance(data, dict):
+ return 'compliant'
+ ouvrages = data.get('ouvrages', [])
+ if not isinstance(ouvrages, list) or not ouvrages:
+ return 'compliant'
+
+ has_damaged = False
+ has_non_compliant = False
+
+ for ouv in ouvrages:
+ if not isinstance(ouv, dict):
+ continue
+ device_type = (ouv.get('device_type') or 'evc').lower()
+ q = ouv.get('questions') or {}
+ if not isinstance(q, dict):
+ continue
+
+ def is_val(key, *expected):
+ v = q.get(key)
+ if isinstance(v, bool):
+ v_str = 'true' if v else 'false'
+ elif v is None:
+ v_str = 'null'
+ else:
+ v_str = str(v).strip().lower()
+ return v_str in [str(e).strip().lower() for e in expected]
+
+ if device_type == 'evc':
+ # 1. Point d'entrée
+ if is_val('evc_pe_ok', 'false', 'non'):
+ has_non_compliant = True
+
+ # 2. Empierrement
+ if is_val('evc_empierrement_present', True, 'true'):
+ if is_val('evc_empierrement_ok', 'false', 'non'):
+ has_non_compliant = True
+ if is_val('evc_empierrement_emporte', True, 'true'):
+ has_damaged = True
+
+ # 3. Végétation
+ if is_val('evc_ev_veg_etat', 'mauvais'):
+ has_non_compliant = True
+ if is_val('evc_ev_plantes_mortes', 'plus_10', '+ de 10%'):
+ has_damaged = True
+
+ # 4. Chenaux d'érosion
+ if is_val('evc_ev_chenaux_erosion', 'true', 'oui', True):
+ has_non_compliant = True
+
+ # 5. Flaques d'eau
+ if is_val('evc_ev_flaques', 'true', 'oui', True):
+ has_non_compliant = True
+
+ # 6. Sédiments
+ if is_val('evc_ev_sediments', 'true', 'oui', True):
+ has_non_compliant = True
+ if is_val('evc_ev_croute_sediments', 'true', 'oui', True):
+ has_damaged = True
+
+ # 7. Espèces envahissantes
+ if is_val('evc_ev_envahissantes', 'true', 'oui', True):
+ has_non_compliant = True
+
+ # 8. Surverse
+ if is_val('evc_surverse_presente', True, 'true'):
+ if is_val('evc_sv_grille_propre', 'false', 'non'):
+ has_non_compliant = True
+ if is_val('evc_sv_decantation_vide', 'false', 'non'):
+ has_non_compliant = True
+ if is_val('evc_sv_haute', 'false', 'non'):
+ has_damaged = True
+
+ elif device_type == 'oed':
+ # 1. Revêtement général
+ if is_val('oed_revetement_ok', 'false', 'non'):
+ has_non_compliant = True
+
+ # 2. Bouche d'injection
+ if is_val('oed_injection_presente', True, 'true'):
+ if is_val('oed_bi_niveaux_ok', 'false', 'non'):
+ has_damaged = True
+ if is_val('oed_bi_grille_propre', 'false', 'non'):
+ has_non_compliant = True
+ if is_val('oed_bi_decantation_vide', 'false', 'non'):
+ has_damaged = True
+ if is_val('oed_bi_drain_colmate', 'true', 'oui', True):
+ has_damaged = True
+
+ # 3. Structure enherbée / minérale
+ if is_val('oed_rhm_presente', True, 'true'):
+ if is_val('oed_rhm_stagne', 'true', 'oui', True):
+ has_non_compliant = True
+ if is_val('oed_rhm_joints_ok', 'false', 'non'):
+ has_non_compliant = True
+ if is_val('oed_rhm_joints_fines', 'true', 'oui', True):
+ has_damaged = True
+ if is_val('oed_rhm_joints_remplissage', 'true', 'oui', True):
+ has_non_compliant = True
+
+ # 4. Modulaire poreux / continu poreux
+ if is_val('oed_rp_presente', True, 'true'):
+ if is_val('oed_rp_stagne', 'true', 'oui', True):
+ has_non_compliant = True
+ if is_val('oed_rp_depots', 'true', 'oui', True):
+ has_non_compliant = True
+
+ elif device_type == 'ta':
+ # 1. Point d'entrée
+ if is_val('ta_pe_ok', 'false', 'non'):
+ has_non_compliant = True
+ if is_val('ta_pe_conduits_ok', 'false', 'non'):
+ has_damaged = True
+ if is_val('ta_pe_decantation_vide', 'false', 'non'):
+ has_non_compliant = True
+
+ # 2. Bassin d'orage
+ if is_val('ta_bo_vegetation_etat', 'mauvais'):
+ has_non_compliant = True
+ if is_val('ta_bo_plantes_mortes', 'plus_10', '+ de 10%'):
+ has_damaged = True
+ if is_val('ta_bo_chenaux', 'true', 'oui', True):
+ has_non_compliant = True
+ if is_val('ta_sediments', 'true', 'oui', True):
+ has_non_compliant = True
+ if is_val('ta_sediments_rempli', 'true', 'oui', True):
+ has_damaged = True
+ if is_val('ta_bo_envahissantes', 'true', 'oui', True):
+ has_non_compliant = True
+
+ if has_damaged:
+ return 'damaged'
+ if has_non_compliant:
+ return 'non_compliant'
+ return 'compliant'
+
class SignPanelInspection(Inspection):
"""
diff --git a/loko/inspections/templates/inspections/components/asset_details/_naturerwiz.html b/loko/inspections/templates/inspections/components/asset_details/_naturerwiz.html
index 3e99659..f58c8d0 100644
--- a/loko/inspections/templates/inspections/components/asset_details/_naturerwiz.html
+++ b/loko/inspections/templates/inspections/components/asset_details/_naturerwiz.html
@@ -97,21 +97,25 @@
{% endwith %}
{% with val=q|get_q_val:'evc_pe_feuilles' %}
+ {% if val != 'null' and val is not None %}
{% translate "Des feuilles ou branches bloquent-elles l'eau ?" %}
{% if val == 'true' or val == True or val == 'oui' %}Oui{% elif val == 'false' or val == False or val == 'non' %}Non{% else %}Non vérifié{% endif %}
+ {% endif %}
{% endwith %}
{% with val=q|get_q_val:'evc_pe_detritus' %}
+ {% if val != 'null' and val is not None %}
{% translate "Un amas de détritus bloque-t-il l'eau ?" %}
{% if val == 'true' or val == True or val == 'oui' %}Oui{% elif val == 'false' or val == False or val == 'non' %}Non{% else %}Non vérifié{% endif %}
+ {% endif %}
{% endwith %}
{% with val=q|get_q_val:'evc_empierrement_present' %}
@@ -283,6 +287,17 @@
{% endwith %}
+
+ {% with val=q|get_q_val:'ta_pe_decantation_vide' %}
+ {% if val != 'null' and val is not None %}
+
+ {% translate "La décantation est-elle vide ou presque ?" %}
+
+ {% if val == 'true' or val == True or val == 'oui' %}Oui{% elif val == 'false' or val == False or val == 'non' %}Non{% else %}Non vérifié{% endif %}
+
+