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 <jlmulder@xs4all.nl>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-11-04 15:19:29 +01:00 committed by Dirk Hohndel
parent a2b3d0ff06
commit 83ed75f4ab

View file

@ -753,9 +753,9 @@ void DiveTripModel::addDivesToTrip(int trip, const QVector<dive *> &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());
}