aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-08-22 18:37:39 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-08-24 13:06:50 -0700
commit7d22b52afc944bc7d701148c997488aa6f2a0cb1 (patch)
tree821aba31ebe896f54b0447c3d7eaf113db318684
parent5de49401c89ccfd411d1f5280c2c2e3c6b231fe1 (diff)
downloadsubsurface-7d22b52afc944bc7d701148c997488aa6f2a0cb1.tar.gz
Grab correct dive number on Shearwater Desktop import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
-rw-r--r--core/parse-xml.c4
1 files 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);