diff --git a/app/blueprints/services/models/flag.py b/app/blueprints/services/models/flag.py index a75a1f56..29a2649e 100644 --- a/app/blueprints/services/models/flag.py +++ b/app/blueprints/services/models/flag.py @@ -27,6 +27,12 @@ def __post_init__(self): item["date_created"] ).strftime("%Y-%m-%d %X") + # sort the updates in the order they are created + if self.updates: + self.updates = sorted( + self.updates, key=lambda x: x["date_created"] + ) + self.latest_user_id = ( self.updates[-1]["user_id"] if self.updates else "" )