From dfb07ae7ee22e7d9c08d04089597e41fe225493f Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Sat, 25 May 2024 17:53:51 +0200 Subject: [PATCH] sort vehicles by last activity --- app/routes/pitstop.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/routes/pitstop.py b/app/routes/pitstop.py index dde6742..3962e0d 100644 --- a/app/routes/pitstop.py +++ b/app/routes/pitstop.py @@ -226,5 +226,6 @@ def get_pit_stops(): "regulars": vehicle.regulars, } user["vehicles"].append(v) + user["vehicles"].sort(key=lambda v: (v["data"][-1].date, v["data"][-1].odometer or 0 ), reverse=True) return render_template("pitstops.html", user=user)