diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-07-15 09:14:31 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-07-23 11:30:17 -0700 |
commit | 846e1ba53e32aaeae22b72d4a7843700627f2b27 (patch) | |
tree | 4843358441c48c37658da6826f08e983602391c8 /dives | |
parent | 72bdd506f07d6a2cc9652efe0353a85d9b8e481a (diff) | |
download | subsurface-846e1ba53e32aaeae22b72d4a7843700627f2b27.tar.gz |
core: always create a fake profile if there are no samples
Before making the cylinder-table dynamic, dives always
had at least one cylinger. When such a dive is displayed,
the TabDiveInformation class calls per_cylinder_mean_depth().
If there are no samples, this function generates a "fake
profile" with fake_dc(). Thus, effectively dives always
had samples once the user was displaying them.
When the cylinder-table was made dynamic, dives without
cylinders were supported. This can notably happen, when
importing from CSV (this could actually be a bug).
per_cylinder_mean_depth() exits early in that case and
doesn't create a fake profile. This lead to crashes
of the profile-widget, which were fixed in 6b2e56e5131.
Non-sample dives were now shown with the Subsurface-logo.
To restore the previous behavior, genarate a fake profile
for sample-less dives in fixup_dive(), which is called
anytime a dive is loaded or imported. This seems to
have been the intention anyway and this worked only
"by chance". This will make a few fake_dc() calls obsolete,
but so be it.
Since fake profiles are now generated on loading,
the parse-tests need to be fixed to account for that.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dives')
-rw-r--r-- | dives/test40-42.xml | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/dives/test40-42.xml b/dives/test40-42.xml index f7dc034e4..727aa5475 100644 --- a/dives/test40-42.xml +++ b/dives/test40-42.xml @@ -6,32 +6,56 @@ </site> </divesites> <dives> -<dive number='1' date='2013-10-01' time='10:34:00' duration='45:00 min'> +<dive number='1' otu='9' cns='5%' date='2013-10-01' time='10:34:00' duration='45:00 min'> <buddy>Dirk</buddy> <suit>wet, 5mm</suit> - <divecomputer model='csv' deviceid='ffffffff'> + <divecomputer model='csv' last-manual-time='45:00 min' deviceid='ffffffff'> <depth max='18.0 m' mean='16.0 m' /> + <sample time='0:00 min' depth='0.0 m' /> + <sample time='2:00 min' depth='18.0 m' /> + <sample time='38:31 min' depth='18.0 m' /> + <sample time='39:51 min' depth='5.94 m' /> + <sample time='44:20 min' depth='5.94 m' /> + <sample time='45:00 min' depth='0.0 m' /> </divecomputer> </dive> -<dive number='2' date='2013-10-01' time='12:13:00' duration='41:00 min'> +<dive number='2' otu='5' cns='7%' date='2013-10-01' time='12:13:00' duration='41:00 min'> <buddy>Linus</buddy> <suit>wet, shorty, 3mm</suit> - <divecomputer model='csv' deviceid='ffffffff'> + <divecomputer model='csv' last-manual-time='41:00 min' deviceid='ffffffff'> <depth max='16.2 m' mean='13.5 m' /> + <sample time='0:00 min' depth='0.0 m' /> + <sample time='1:48 min' depth='16.2 m' /> + <sample time='31:41 min' depth='16.2 m' /> + <sample time='32:53 min' depth='5.346 m' /> + <sample time='40:24 min' depth='5.346 m' /> + <sample time='41:00 min' depth='0.0 m' /> </divecomputer> </dive> <dive number='3' date='2014-10-01' time='10:02:00' duration='48:00 min'> <buddy>Tomaz</buddy> <suit>none</suit> - <divecomputer model='csv' deviceid='ffffffff'> + <divecomputer model='csv' last-manual-time='48:00 min' deviceid='ffffffff'> <depth max='13.3 m' mean='11.5 m' /> + <sample time='0:00 min' depth='0.0 m' /> + <sample time='1:29 min' depth='13.3 m' /> + <sample time='39:02 min' depth='13.3 m' /> + <sample time='40:02 min' depth='4.389 m' /> + <sample time='47:31 min' depth='4.389 m' /> + <sample time='48:00 min' depth='0.0 m' /> </divecomputer> </dive> -<dive number='4' date='2014-10-01' time='14:19:00' duration='34:00 min'> +<dive number='4' otu='13' cns='5%' date='2014-10-01' time='14:19:00' duration='34:00 min'> <buddy>Don</buddy> <suit>dry, Whites Fusion</suit> - <divecomputer model='csv' deviceid='ffffffff'> + <divecomputer model='csv' last-manual-time='34:00 min' deviceid='ffffffff'> <depth max='24.9 m' mean='20.1 m' /> + <sample time='0:00 min' depth='0.0 m' /> + <sample time='2:46 min' depth='24.9 m' /> + <sample time='25:35 min' depth='24.9 m' /> + <sample time='27:26 min' depth='8.217 m' /> + <sample time='33:05 min' depth='8.217 m' /> + <sample time='34:00 min' depth='0.0 m' /> </divecomputer> </dive> <dive number='417' otu='138' cns='54%' divesiteid='deadbeef' date='2015-05-23' time='13:23:00' duration='100:00 min'> |