mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Uemis downloader: new logic for divespots
Changed the do_uemis_import to load divespots right after matching the dive details. Logic implemented to verify that we are not duplicating divespots by comparing the uuid from get_dive_site_by_uuid(dive->dive_site_uuid) with the one from get_dive_site_uuid_by_name Signed-off-by: glerch <guido.lerch@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e7fa81f9ea
commit
8e82e14b1e
1 changed files with 19 additions and 2 deletions
|
@ -892,8 +892,11 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
|
||||||
if (for_dive)
|
if (for_dive)
|
||||||
*for_dive = atoi(val);
|
*for_dive = atoi(val);
|
||||||
} else if (!is_log && dive && !strcmp(tag, "divespot_id")) {
|
} else if (!is_log && dive && !strcmp(tag, "divespot_id")) {
|
||||||
dive->dive_site_uuid = create_dive_site("from Uemis", dive->when);
|
int divespot_id = atoi(val);
|
||||||
track_divespot(val, dive->dc.diveid, dive->dive_site_uuid);
|
if (divespot_id != -1) {
|
||||||
|
dive->dive_site_uuid = create_dive_site("from Uemis", dive->when);
|
||||||
|
uemis_mark_divelocation(dive->dc.diveid, divespot_id, dive->dive_site_uuid);
|
||||||
|
}
|
||||||
#if UEMIS_DEBUG & 2
|
#if UEMIS_DEBUG & 2
|
||||||
fprintf(debugfile, "Created divesite %d for diveid : %d\n", dive->dive_site_uuid, dive->dc.diveid);
|
fprintf(debugfile, "Created divesite %d for diveid : %d\n", dive->dive_site_uuid, dive->dc.diveid);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1202,6 +1205,20 @@ const char *do_uemis_import(device_data_t *data)
|
||||||
fprintf(debugfile, "Matching divelog id %d from %s with dive details %d\n", dive->dc.diveid, dTime, iDiveToRead);
|
fprintf(debugfile, "Matching divelog id %d from %s with dive details %d\n", dive->dc.diveid, dTime, iDiveToRead);
|
||||||
#endif
|
#endif
|
||||||
last_found_log_file_nr = dive_to_read;
|
last_found_log_file_nr = dive_to_read;
|
||||||
|
int divespot_id = uemis_get_divespot_id_by_diveid(dive->dc.diveid);
|
||||||
|
if (load_uemis_divespot(mountpath, divespot_id)) {
|
||||||
|
struct dive_site *nds = get_dive_site_by_uuid(dive->dive_site_uuid);
|
||||||
|
struct dive_site *ods = NULL;
|
||||||
|
if (nds) {
|
||||||
|
(void)get_dive_site_uuid_by_name(nds->name, &ods);
|
||||||
|
if (ods) {
|
||||||
|
if (nds->uuid != ods->uuid) {
|
||||||
|
delete_dive_site(nds->uuid);
|
||||||
|
dive->dive_site_uuid = ods->uuid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* in this case we found a deleted file, so let's increment */
|
/* in this case we found a deleted file, so let's increment */
|
||||||
#if UEMIS_DEBUG & 2
|
#if UEMIS_DEBUG & 2
|
||||||
|
|
Loading…
Add table
Reference in a new issue