core: move get_same_dive_site() into dive_site_table class

This was the only dive_site_table function that accessed
to global divelog, which is odd. Make it consistent with
the others.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-11 18:41:49 +02:00 committed by bstoeger
parent 4ac2486a23
commit 512eada468
4 changed files with 7 additions and 10 deletions

View file

@ -99,10 +99,9 @@ ImportDiveSites::ImportDiveSites(dive_site_table sites, const QString &source)
setText(Command::Base::tr("import dive sites from %1").arg(source));
for (auto &new_ds: sites) {
// Don't import dive sites that already exist. Currently we only check for
// the same name. We might want to be smarter here and merge dive site data, etc.
struct dive_site *old_ds = get_same_dive_site(*new_ds);
if (old_ds)
// Don't import dive sites that already exist.
// We might want to be smarter here and merge dive site data, etc.
if (divelog.sites->get_same(*new_ds))
continue;
sitesToAdd.push_back(std::move(new_ds));
}