From 7d22b52afc944bc7d701148c997488aa6f2a0cb1 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Tue, 22 Aug 2017 18:37:39 +0300 Subject: Grab correct dive number on Shearwater Desktop import Signed-off-by: Miika Turkia --- core/parse-xml.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/parse-xml.c b/core/parse-xml.c index fa9bbe26a..bc2dbdd97 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -2743,7 +2743,7 @@ extern int shearwater_dive(void *param, int columns, char **data, char **column) int retval = 0; sqlite3 *handle = (sqlite3 *)param; char *err = NULL; - char get_profile_template[] = "select currentTime,currentDepth,waterTemp,averagePPO2,currentNdl,CNSPercent,decoCeiling from dive_log_records where diveLogId = %d"; + char get_profile_template[] = "select currentTime,currentDepth,waterTemp,averagePPO2,currentNdl,CNSPercent,decoCeiling from dive_log_records AS r join dive_logs as l on r.diveLogId=l.diveId where diveLogId = %d"; char get_cylinder_template[] = "select fractionO2,fractionHe from dive_log_records where diveLogId = %d group by fractionO2,fractionHe"; char get_changes_template[] = "select a.currentTime,a.fractionO2,a.fractionHe from dive_log_records as a,dive_log_records as b where a.diveLogId = %d and b.diveLogId = %d and (a.id - 1) = b.id and (a.fractionO2 != b.fractionO2 or a.fractionHe != b.fractionHe) union select min(currentTime),fractionO2,fractionHe from dive_log_records"; char get_buffer[1024]; @@ -3030,7 +3030,7 @@ int parse_shearwater_buffer(sqlite3 *handle, const char *url, const char *buffer char *err = NULL; target_table = table; - char get_dives[] = "select i.diveId,timestamp,location||' / '||site,buddy,notes,imperialUnits,maxDepth,maxTime,startSurfacePressure,computerSerial,computerModel FROM dive_info AS i JOIN dive_logs AS l ON i.diveId=l.diveId"; + char get_dives[] = "select l.number,timestamp,location||' / '||site,buddy,notes,imperialUnits,maxDepth,maxTime,startSurfacePressure,computerSerial,computerModel FROM dive_info AS i JOIN dive_logs AS l ON i.diveId=l.diveId"; retval = sqlite3_exec(handle, get_dives, &shearwater_dive, handle, &err); -- cgit v1.2.3-70-g09d2