Corriger l'affichage de l'historique des statuts
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run

This commit is contained in:
root 2026-08-20 22:57:32 +00:00
parent 7d64a29601
commit 16c5a5ff88
2 changed files with 17 additions and 4 deletions

View file

@ -300,6 +300,21 @@ class StatusChange(db.Model):
# Relations
changed_by = db.relationship("User", backref="status_changes_list")
@property
def to_label(self):
from app_new.constants import INTERVENTION_STATUSES
return INTERVENTION_STATUSES.get(self.to_status, {}).get("label", self.to_status or "Statut inconnu")
@property
def from_label(self):
from app_new.constants import INTERVENTION_STATUSES
return INTERVENTION_STATUSES.get(self.from_status, {}).get("label", self.from_status or "Création")
@property
def to_color(self):
from app_new.constants import INTERVENTION_STATUSES
return INTERVENTION_STATUSES.get(self.to_status, {}).get("color", "secondary")
def __repr__(self):
return f"<StatusChange {self.from_status}{self.to_status}>"

View file

@ -359,12 +359,10 @@
</div>
<div class="flex-grow-1">
<strong>{{ change.to_label }}</strong>
{% if change.from_status %}
<span class="text-muted small">(de {{ change.from_label }})</span>
{% endif %}
<span class="text-muted small">(de {{ change.from_label }})</span>
<br>
<span class="text-muted small">
Par <strong>{{ change.changed_by.full_name }}</strong> — {{ change.created_at|datetime_fmt if change.created_at else '—' }}
Par <strong>{{ change.changed_by.full_name if change.changed_by else 'Utilisateur supprimé' }}</strong> — {{ change.created_at|datetime_fmt if change.created_at else '—' }}
</span>
{% if change.comment %}
<br><em class="small">{{ change.comment }}</em>