From 37a521eb5d6de7b8bbbb3f85417ce303db6a3622 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 18 Jan 2019 17:08:48 +0100 Subject: Filter: ignore unset temperatures The filter treated unset air and water temperatures as 0 K, leading to many dives not being shown. Don't filter on unset temperatures. Reported-by: Jan Mulder Signed-off-by: Berthold Stoeger --- qt-models/filtermodels.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index 719467fd2..596bcd98f 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -111,10 +111,12 @@ bool MultiFilterSortModel::showDive(const struct dive *d) const // TODO: get the preferences for the imperial vs metric data. // ignore the check if it doesn't makes sense. - if (d->watertemp.mkelvin < C_to_mkelvin(filterData.minWaterTemp) || d->watertemp.mkelvin > C_to_mkelvin((filterData.maxWaterTemp))) + if (d->watertemp.mkelvin && + (d->watertemp.mkelvin < C_to_mkelvin(filterData.minWaterTemp) || d->watertemp.mkelvin > C_to_mkelvin((filterData.maxWaterTemp)))) return false; - if (d->airtemp.mkelvin < C_to_mkelvin(filterData.minAirTemp) || d->airtemp.mkelvin > C_to_mkelvin(filterData.maxAirTemp)) + if (d->airtemp.mkelvin && + (d->airtemp.mkelvin < C_to_mkelvin(filterData.minAirTemp) || d->airtemp.mkelvin > C_to_mkelvin(filterData.maxAirTemp))) return false; if (filterData.from.isValid() && d->when < filterData.from.toTime_t()) -- cgit v1.2.3-70-g09d2