From 066e95bd386c63b6a1f83111b18b9d3e39d67f29 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sat, 20 Dec 2014 18:19:45 +0200 Subject: [PATCH] Fix maximum depth on Cobalt import Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- parse-xml.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parse-xml.c b/parse-xml.c index 1bfc6c4f5..d799850eb 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -2390,7 +2390,7 @@ extern int cobalt_dive(void *param, int columns, char **data, char **column) /* Cobalt stores the pressures, not the depth */ if (data[6]) - cur_dive->dc.maxdepth.mm = atoi(data[6]) * 10000 / atoi(data[8]); + cur_dive->dc.maxdepth.mm = atoi(data[6]); if (data[7]) cur_dive->dc.duration.seconds = atoi(data[7]); @@ -2455,7 +2455,7 @@ int parse_cobalt_buffer(sqlite3 *handle, const char *url, const char *buffer, in char *err = NULL; target_table = table; - char get_dives[] = "select Id,strftime('%s',DiveStartTime),LocationId,'buddy','notes',Units,MaxDepthPressure,DiveMinutes,SurfacePressure,SerialNumber,'model' from Dive"; + char get_dives[] = "select Id,strftime('%s',DiveStartTime),LocationId,'buddy','notes',Units,(MaxDepthPressure*10000/SurfacePressure)-10000,DiveMinutes,SurfacePressure,SerialNumber,'model' from Dive"; retval = sqlite3_exec(handle, get_dives, &cobalt_dive, handle, &err);