Dive edit: always use dive site of displayed_dive in updateDiveInfo

The old code had a special case for dive-editing mode:
The dive site uuid of displayed_dive_site instead of displayed_dive
was used.

This makes no sense, because displayed_dive_site is only used by
the dive-site-edit widget, which firstly cannot be activated
during dive-edit and secondly doesn't change the dive site id
anyway.

Thus, use the dive site of the currently edited/displayed dive
in all cases.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-10-12 09:15:36 +02:00 committed by Dirk Hohndel
parent 397e818be1
commit 73b8bd12e5

View file

@ -415,20 +415,11 @@ void MainTab::updateDiveInfo(bool clear)
if (!clear) {
struct dive_site *ds = NULL;
// if we are showing a dive and editing it, let's refer to the displayed_dive_site as that
// already may contain changes, otherwise start with the dive site referred to by the displayed
// dive
if (rememberEM == DIVE) {
ds = &displayed_dive_site;
} else {
ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid);
if (ds)
copy_dive_site(ds, &displayed_dive_site);
}
ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid);
if (ds) {
ui.location->setCurrentDiveSiteUuid(ds->uuid);
ui.locationTags->setText(constructLocationTags(ds, true));
copy_dive_site(ds, &displayed_dive_site);
} else {
ui.location->clear();
ui.locationTags->clear();