From 62e95fdc8656a0c8fdb181c3fe0a48e043650a05 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 14 May 2020 09:48:09 -0700 Subject: [PATCH] Save SAC, OTU and CNS in the XML export We do _not_ read them back, since they are calculated values, although I guess we could aim to do that too at some point in case we have an import from somewhere else that has these values but not the profile (or gas use) to actually calculate them. Fix test-cases that are checked by TestParse (but nothing else) to match. Requested-by: Miika Turkia Signed-off-by: Linus Torvalds --- core/save-xml.c | 10 ++++++++++ dives/TestDiveDM4.xml | 2 +- dives/TestDiveDM5.xml | 8 ++++---- dives/TestDiveDivelogsDE.xml | 2 +- dives/TestDiveSeabearHUDC.xml | 2 +- dives/TestDiveSeabearNewFormat.xml | 16 ++++++++-------- dives/mergedVyperOstc.xml | 8 ++++---- dives/test40-42.xml | 6 +++--- 8 files changed, 32 insertions(+), 22 deletions(-) diff --git a/core/save-xml.c b/core/save-xml.c index 8e3d212eb..54469a1cf 100644 --- a/core/save-xml.c +++ b/core/save-xml.c @@ -502,6 +502,16 @@ void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool anonymize) put_format(b, " chill='%d'", dive->chill); if (dive->invalid) put_format(b, " invalid='1'"); + + // These three are calculated, and not read when loading. + // But saving them into the XML is useful for data export. + if (dive->sac > 100) + put_format(b, " sac='%d.%03d l/min'", FRACTION(dive->sac, 1000)); + if (dive->otu) + put_format(b, " otu='%d'", dive->otu); + if (dive->maxcns) + put_format(b, " cns='%d%%'", dive->maxcns); + save_tags(b, dive->tag_list); if (dive->dive_site) put_format(b, " divesiteid='%8x'", dive->dive_site->uuid); diff --git a/dives/TestDiveDM4.xml b/dives/TestDiveDM4.xml index 2e00cd767..053de2ea7 100644 --- a/dives/TestDiveDM4.xml +++ b/dives/TestDiveDM4.xml @@ -5,7 +5,7 @@ - + Notes are here diff --git a/dives/TestDiveDM5.xml b/dives/TestDiveDM5.xml index cee358bf2..c5eee2aaa 100644 --- a/dives/TestDiveDM5.xml +++ b/dives/TestDiveDM5.xml @@ -5,7 +5,7 @@ - + Notes are here @@ -194,7 +194,7 @@ - + Testing notes @@ -388,7 +388,7 @@ - + Dive notes @@ -597,7 +597,7 @@ - + Notes test diff --git a/dives/TestDiveDivelogsDE.xml b/dives/TestDiveDivelogsDE.xml index 3baac8869..960d53ef3 100644 --- a/dives/TestDiveDivelogsDE.xml +++ b/dives/TestDiveDivelogsDE.xml @@ -6,7 +6,7 @@ - + Linus Second deep dive Linus and I planned and executed - Alex just watching diff --git a/dives/TestDiveSeabearHUDC.xml b/dives/TestDiveSeabearHUDC.xml index 0fde14fce..f4c461697 100644 --- a/dives/TestDiveSeabearHUDC.xml +++ b/dives/TestDiveSeabearHUDC.xml @@ -4,7 +4,7 @@ - + diff --git a/dives/TestDiveSeabearNewFormat.xml b/dives/TestDiveSeabearNewFormat.xml index 1647e609d..f5cea5026 100644 --- a/dives/TestDiveSeabearNewFormat.xml +++ b/dives/TestDiveSeabearNewFormat.xml @@ -211,7 +211,7 @@ - + @@ -418,7 +418,7 @@ - + @@ -1351,7 +1351,7 @@ - + @@ -1557,7 +1557,7 @@ - + @@ -1766,7 +1766,7 @@ - + @@ -1973,7 +1973,7 @@ - + @@ -2180,7 +2180,7 @@ - + @@ -3113,7 +3113,7 @@ - + diff --git a/dives/mergedVyperOstc.xml b/dives/mergedVyperOstc.xml index c820fbed7..a79bc0a3e 100644 --- a/dives/mergedVyperOstc.xml +++ b/dives/mergedVyperOstc.xml @@ -6,7 +6,7 @@ - + @@ -103,7 +103,7 @@ - + @@ -194,7 +194,7 @@ - + @@ -420,7 +420,7 @@ - + diff --git a/dives/test40-42.xml b/dives/test40-42.xml index ef239fa3c..f591d8366 100644 --- a/dives/test40-42.xml +++ b/dives/test40-42.xml @@ -34,7 +34,7 @@ - + {\rtf1\ansi\ansicpg1252\deff0\deflang1035{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}} \viewkind4\uc1\pard\f0\fs17\par } @@ -747,7 +747,7 @@ - + CCR dive @@ -3244,7 +3244,7 @@ - + CCR dive