Commit graph

40 commits

Author SHA1 Message Date
Michael Keller
e260780c9d Export: Fix Cylinder Pressures in CSV Export.
Fix the cylinder pressures in the CSV summary export. Only show
pressures derived from `pressure` attributes in samples for the first
cylinder. Add support for showing pressures derived from `pressure0` ...
`pressureX` attributes.
Also cleaned up unit conversions, and changed tabs to spaces.
From discussion in
https://github.com/subsurface/subsurface/pull/3906#issuecomment-1575980882.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-25 16:24:52 -07:00
Michael Keller
4c193d7bdf Desktop: Rework the Summary CSV Export XSLT.
Rework of the XSLT used to generate the Summary CSV export:
- fixed a bug causing invalid CSV to be generated for double quotes
  (`""`);
- changed quoting and escaping to be compliant with RFC 4180;
- changed output to contain information for all cylinders for all dives
  (instead of limiting the number of cylinders to howevermany are used
   for the last dive);
- added an index to the cylinder data headings;
- changed unit designators to use `[]` instead of `()`;
- some minor improvements to the XSLT.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-31 20:11:39 +03:00
Michael Keller
1bd7806dcf Desktop: Change 'CSV summary dive details' output from TSV to CSV.
Change the output formato for the Export / 'CSV summary dive details'
from TSV to CSV, to make it consistent with the menu item name, and with
the other 'CSV' export function.
This was changed to TSV by @mturkia in
6c82578540,
but I could not find any discussion as to why.
Also removed replacement of the field separator in any fields, as,
according to the CSV RFC (https://datatracker.ietf.org/doc/html/rfc4180)
this is not required as long as the fields containing separators are
enclosed in quotes, and any quotes within the fields are doubled up.
Tested with a fairly large log file, and importing into Google Sheets is
working fine for the output produced.
Also made capitalisation of the Export menu items consistent.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-18 10:31:31 +03:00
Miika Turkia
2d108cb8ad Fix indentation
The diff goes crazy if indentation is not fixed by itself.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-31 08:59:47 -07:00
Miika Turkia
3dc5ac219d Print empty cylinder, if needed
When the dive that is used to generate the header, we need to print
empty cylinders for the dives that had less cylinders than the one used
for header printing.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-31 08:59:47 -07:00
Miika Turkia
108b30e8b5 Print at most as many cylinders as the header has
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-31 08:59:47 -07:00
Miika Turkia
8f7c9bc7d1 Limit cylinders to one dive only
With XSLT we have to be specific if we want to apply cylinder iteration
operation to one dive only. Thus using the last dive as reference when
printing cylinder header.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-31 08:59:47 -07:00
Miika Turkia
0acf8721d3 Trip support for CSV export of dive details
Debugging the tests with new test dive, I noticed that CSV export does
not work, if the exported XML includes trips.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
889f36a57c Multi cylinder support for CSV export
Fixes #2830

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
19cdab52b3 CSV export: Split printing of header
This will split the printing of header for CSV export. Cylinder
information is printed by itself allowing me to later print it in a loop
as many times as there are cylinders.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
0525f31510 CSV export: include SAC when exporting dive details
Simply adds SAC field to CSV export of dive details.

Fixes #2829

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-18 09:32:58 -07:00
Miika Turkia
3e2a410f93 format for readability
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-18 09:32:58 -07:00
Miika Turkia
e1c3f29b88 CSV export: Add dive mode
Include dive mode to exported dive detail CSV

Closes #1588

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-04 10:43:40 +02:00
Miika Turkia
96ee6898e8 Fix special case for temperature in CSV export
The old code took air and water temperatures primarily from
dive/divetemperature or secondarily if the previous one didn't have
either one of them from divecomputer/temperature. The new code attempts
to take first air temperature from dive/divetemperature or
diveomputer/temperature and then on a separate run the water
temperature from these both. Thus we should be fine if one temperature
is in dive/divetemperature and the other in divecomputer/temperature.

Fixes #2169

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-07-13 08:48:26 -07:00
Miika Turkia
f96d155759 CSV export: include unquoted quotable fields
Turns out that the initial quoting implementation discarded the fields
without quoting. This one ensures we should be getting also that data
exported.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07 17:41:14 +03:00
Miika Turkia
c44ece0ea1 CSV export: quote quotes
If a text field contains quotation mark ("), encode this with double
quote ("").

Fixes #1679

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07 17:41:14 +03:00
Stefan Fuchs
46f1fea1b6 CSV export: Correct numeric format for depth
Add two missing format-number functions for mean depth in dive list
export and depth in dive profile export.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-19 11:59:58 -07:00
Stefan Fuchs
fc01045680 CSV export: Modify format of dive list and dive profile export
In dive list CSV export:
- Move unit "min" from duration field to header
- Move unit "%" from O2 and He fields to header

In dive profile CSV export:
- Add "min" to sample time header
- Add column for sample heart rate

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-19 11:59:58 -07:00
Miika Turkia
8f61dfe812 Fix CSV export for imperial start and end pressure
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-15 14:44:07 +09:00
Miika Turkia
0135597265 CSV export: show units on header
Let's show the units in CSV header so the actual fields have only the
values. This should be easier to parse with some other programs.

Fixes #472

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-15 14:44:07 +09:00
Miika Turkia
25a628bf8d More precision in CSV export for depths
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01 08:06:09 -07:00
Miika Turkia
841d1b4fac CSV export: convert cylinder size to imperial
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01 08:06:09 -07:00
Miika Turkia
1c03cb259e CSV export: export only existing temperatures
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01 08:06:09 -07:00
Miika Turkia
0a1224b693 Fix imperial conversion for weight on CSV export
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-02-26 11:30:32 -08:00
Miika Turkia
ee0bdd9043 CSV export
Need to discard dive site notes on csv export..

miika

From ab23245e2acee32410fa680d0eaab098af69b5c2 Mon Sep 17 00:00:00 2001
From: Miika Turkia <miika.turkia@gmail.com>
Date: Mon, 21 Mar 2016 17:50:28 +0800
Subject: [PATCH] CSV export: discard dive site notes

The new format of divesite management breaks the CSV export as the notes
of divesites are matched.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-22 08:45:04 -07:00
Miika Turkia
e8df3da9e3 CSV export: support for new location management
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-06 07:40:40 -07:00
Miika Turkia
6c82578540 Switching to tab delimited CSV export
Use tab as separator when exporting dive details to CSV file. This also
replaces tabs and line feeds from notes with spaces.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-24 14:50:16 -08:00
Miika Turkia
f8f5e73dae Improve testing whether we have temp and depth info
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-22 21:49:08 +12:00
Miika Turkia
c00a5614f3 Add required empty fields on CSV export
We need to have empty field printed for every value on the CSV export.
Hopefully this is enough.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-05 09:06:05 -08:00
Miika Turkia
48019a73d5 Imperial support for CSV details export
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-31 12:12:26 -08:00
Miika Turkia
e471335af6 Include tags on CSV export
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-26 08:43:37 -08:00
Miika Turkia
e750eb1686 Export total weight on CSV export
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-26 08:43:30 -08:00
Miika Turkia
0b040b769d Store more cylinder information on manual CSV export
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-26 08:43:24 -08:00
Miika Turkia
4cf0f77d8a Save info only from first cylinder on CSV export
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-26 08:41:08 -08:00
Miika Turkia
a950365b6f Include some empty fields if they are not available
If specific value is not available, we need to have an empty value
instead.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-22 14:25:52 -08:00
Miika Turkia
663f6eef0b Include empty location and gps if non is given
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-22 14:25:35 -08:00
Miika Turkia
f9b7b9bba0 Take pressure info from first DC on CSV export
Try to grab pressure information from first DC if it is not manually
entered.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-22 14:25:16 -08:00
Miika Turkia
f1b3ecbfa9 Take depths from first DC on CSV export
We need to limit the DCs from which we grab the depths. Otherwise, we
end up with too many depth values.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-22 14:23:50 -08:00
Miika Turkia
898a62f888 Grab divecomputer/temperature on CSV export
If temperature is recorded by a DC it must be taken from under the
divecomputer tag. However, this will prefer the manually written value
if such exists.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-22 14:23:38 -08:00
Dirk Hohndel
74f5842f0c Add second CSV export with dive details
This is intended to export all the details that someone might copy from a
paper logbook. We need a matching import template to make this simple.

This hasn't been well tested, I'm sure it will break when elements and
attributes are missing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-21 21:51:54 -08:00