mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile: do not just create a new dive site
This fixes an annoying bug. When entering an existing divesite in the mobile app, always a new divesite (with same name) was created, resulting in multiple sites on the same gps location. So, be more carefull in checking and creating a new site. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
parent
3a64d8a481
commit
5707554e98
1 changed files with 8 additions and 4 deletions
|
@ -814,12 +814,16 @@ parsed:
|
|||
bool QMLManager::checkLocation(DiveObjectHelper *myDive, struct dive *d, QString location, QString gps)
|
||||
{
|
||||
bool diveChanged = false;
|
||||
|
||||
struct dive_site *ds = get_dive_site_by_uuid(d->dive_site_uuid);
|
||||
uint32_t uuid;
|
||||
struct dive_site *ds = get_dive_site_for_dive(d);
|
||||
if (myDive->location() != location) {
|
||||
diveChanged = true;
|
||||
ds = get_dive_site_by_uuid(create_dive_site(qPrintable(location), d->when));
|
||||
d->dive_site_uuid = ds->uuid;
|
||||
if (!ds) {
|
||||
uuid = get_dive_site_uuid_by_name(qPrintable(location), NULL);
|
||||
if (!uuid)
|
||||
uuid = create_dive_site(qPrintable(location), d->when);
|
||||
}
|
||||
d->dive_site_uuid = uuid;
|
||||
}
|
||||
// now make sure that the GPS coordinates match - if the user changed the name but not
|
||||
// the GPS coordinates, this still does the right thing as the now new dive site will
|
||||
|
|
Loading…
Add table
Reference in a new issue