summaryrefslogtreecommitdiffstats
path: root/datatrak.c
diff options
context:
space:
mode:
authorGravatar Salvador Cuñat <salvador.cunat@gmail.com>2015-03-19 17:44:45 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-19 11:20:06 -0700
commit4571aa7ac6b25883cd01adf35dacc56e7cb8100d (patch)
tree32ee048092529421272044451081055df3c2cda6 /datatrak.c
parentf1ab6dd38688d3e98123c22e073c9be32f802db7 (diff)
downloadsubsurface-4571aa7ac6b25883cd01adf35dacc56e7cb8100d.tar.gz
Avoid duplicities on dive sites while importing
Instead of create an uuid for every imported dive, check if it exists. If not create a new one. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'datatrak.c')
-rw-r--r--datatrak.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/datatrak.c b/datatrak.c
index 2544eedac..573796cfe 100644
--- a/datatrak.c
+++ b/datatrak.c
@@ -217,7 +217,9 @@ static struct dive dt_dive_parser(FILE *archivo, struct dive *dt_dive)
* Locality and Dive points.
*/
snprintf(buffer, sizeof(buffer), "%s, %s", locality, dive_point);
- dt_dive->dive_site_uuid = create_dive_site(buffer);
+ dt_dive->dive_site_uuid = get_dive_site_uuid_by_name(buffer, NULL);
+ if (dt_dive->dive_site_uuid == 0)
+ dt_dive->dive_site_uuid = create_dive_site(buffer);
free(locality);
free(dive_point);