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 <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2020-05-14 09:48:09 -07:00
parent 1f942ab556
commit 62e95fdc86
8 changed files with 32 additions and 22 deletions

View file

@ -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);