mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Do not save dive sites that are not used
As it is not possible to delete dive sites from the logbook, we need to make sure that we never save sites that are not tied to any dive. With this change, unused site that are currently in the logbook will also be removed, so it will also clear up (wrong) historical data. Supposed to fix #786 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
parent
20510d4ff7
commit
8d0361ff77
2 changed files with 2 additions and 2 deletions
|
@ -904,7 +904,7 @@ static void save_divesites(git_repository *repo, struct dir *tree)
|
|||
for (int i = 0; i < dive_site_table.nr; i++) {
|
||||
struct membuffer b = { 0 };
|
||||
struct dive_site *ds = get_dive_site(i);
|
||||
if (dive_site_is_empty(ds)) {
|
||||
if (dive_site_is_empty(ds) || !is_dive_site_used(ds->uuid, false)) {
|
||||
int j;
|
||||
struct dive *d;
|
||||
for_each_dive(j, d) {
|
||||
|
|
|
@ -571,7 +571,7 @@ void save_dives_buffer(struct membuffer *b, const bool select_only)
|
|||
int j;
|
||||
struct dive *d;
|
||||
struct dive_site *ds = get_dive_site(i);
|
||||
if (dive_site_is_empty(ds)) {
|
||||
if (dive_site_is_empty(ds) || !is_dive_site_used(ds->uuid, false)) {
|
||||
for_each_dive(j, d) {
|
||||
if (d->dive_site_uuid == ds->uuid)
|
||||
d->dive_site_uuid = 0;
|
||||
|
|
Loading…
Reference in a new issue