diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-07-24 13:59:11 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-14 22:40:14 -0600 |
commit | 5b14ed16accc39a1ed46f894404b10655576e386 (patch) | |
tree | a9c4ad2021f2f64be4b38c69a87dbea82f9b5c05 /dive.c | |
parent | 87ca15c5c35f32049f66f3cb2da1dc723bc5c1a9 (diff) | |
download | subsurface-5b14ed16accc39a1ed46f894404b10655576e386.tar.gz |
Add "download into private trip" dialog checkmark
This adds a checkbox for the divecomputer download dialog that allows you
to tell the download to put the newly downloaded dives into a trip of
their own. That in turn will disable the dive merging with any existing
dives, which means that you will not mix up your newly downloaded dives
with any old dives.
That, in turn, is very convenient of you know that some of the dives were
done by other divers (or from testing that happened during servicing etc),
or the dive dates etc were wrong because the dive computer date had reset
due to battery changes etc.
Once you have all the dives in a private trip of their own, you can then
fix them up (delete dives you don't want to merge etc), and then after all
the data is ok you might want to merge the cleaned-up results with
previous trips etc, and then manually ask subsurface to merge the dives or
whatever.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -1860,6 +1860,11 @@ static int match_dc_dive(struct divecomputer *a, struct divecomputer *b) return 0; } +static bool new_without_trip(struct dive *a) +{ + return a->downloaded && !a->divetrip; +} + /* * Do we want to automatically try to merge two dives that * look like they are the same dive? @@ -1893,9 +1898,16 @@ static int likely_same_dive(struct dive *a, struct dive *b) { int match, fuzz = 20 * 60; - /* Don't try to merge dives in different trips */ - if (a->divetrip && b->divetrip && a->divetrip != b->divetrip) - return 0; + /* Don't try to merge dives with different trip information */ + if (a->divetrip != b->divetrip) { + /* + * Exception: if the dive is downloaded without any + * explicit trip information, we do want to merge it + * with existing old dives even if they have trips. + */ + if (!new_without_trip(a) && !new_without_trip(b)) + return 0; + } /* * Do some basic sanity testing of the values we |