From 83ed75f4ab7494bc4597246a8a50b9c54122843f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 4 Nov 2018 15:19:29 +0100 Subject: [PATCH] Dive list: use proper comparison when comparing dive to trip The DiveTripModels are sorted in *reverse* chronological order. Therefore, when comparing a dive against a trip, the dive has to be inserted if the dive has a *later* date. Change the comparison accordingly. Reported-by: Jan Mulder Signed-off-by: Berthold Stoeger --- qt-models/divetripmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 33f0dd46c..7c86d6b73 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -753,9 +753,9 @@ void DiveTripModel::addDivesToTrip(int trip, const QVector &dives) // before the trip in the case of equal timestamps. bool DiveTripModel::dive_before_entry(const dive *d, const Item &entry) { - // Dives at the same time come before trips, therefore use the "<=" operator. + // Dives at the same time come before trips, therefore use the ">=" operator. if (entry.trip) - return d->when <= entry.trip->when; + return d->when >= entry.trip->when; return !dive_less_than(d, entry.getDive()); }