Dive site: ignore dive sites without location in proximity search

When editing a dive site, the user can search for close dive sites
to merge duplicates. Dive sites without location are treated as
being located at 0N0E. This makes no sense, because:

When selecting a dive site without location, we shouldn't list
dive sites close to 0N0E.

Likewise when having a dive site close to 0N0E, we shouldn't list
dive sites that have no location.

Therefore, ignore these cases.

This also means that now dive sites without location are not
considered as close to other dive sites without location. That
might be a debatable point.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-02-03 10:08:44 +01:00 committed by Dirk Hohndel
parent 670a5bd55a
commit 3fc2da567b
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,4 @@
Desktop: ignore dive sites without location in proximity search
Mobile: add personalized option for units
Mobile: add Dive Summary page
Mobile: option to reset default cylinder

View file

@ -285,8 +285,11 @@ GeoReferencingOptionsModel::GeoReferencingOptionsModel(QObject *parent) : QStrin
bool GPSLocationInformationModel::filterAcceptsRow(int sourceRow, const QModelIndex &parent) const
{
if (!has_location(&location))
return false;
struct dive_site *ds = sourceModel()->index(sourceRow, LocationInformationModel::DIVESITE, parent).data().value<dive_site *>();
if (!ds || ds == ignoreDs || ds == RECENTLY_ADDED_DIVESITE)
if (!ds || ds == ignoreDs || ds == RECENTLY_ADDED_DIVESITE || !has_location(&ds->location))
return false;
return distance <= 0 ? same_location(&ds->location, &location)