From bc7e1591bd1d515db699e7a4077c0b33e274049b Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Wed, 23 Jun 2021 08:29:35 +0200 Subject: [PATCH] fix sorting for regular costs --- app/tools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/tools.py b/app/tools.py index 7936153..e7ff34a 100644 --- a/app/tools.py +++ b/app/tools.py @@ -204,7 +204,9 @@ def compute_lower_limits_for_new_pitstop( def pitstop_service_key(x): - return x.date, x.odometer + # if the entry got no odometer (regular costs!) then we assume it's okay + # to have regular cost at a virtual odometer of 0 on that day. + return x.date, x.odometer or 0 def get_event_line_for_vehicle(vehicle):