From 4571aa7ac6b25883cd01adf35dacc56e7cb8100d Mon Sep 17 00:00:00 2001 From: Salvador Cuñat Date: Thu, 19 Mar 2015 17:44:45 +0100 Subject: Avoid duplicities on dive sites while importing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Dirk Hohndel --- datatrak.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3-70-g09d2