mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
When downloading from a dive computer, stop at mergeable dives
The divecomputer download code will stop at a matching dive (unless you check the "Download all dives" option when downloading). However, the matching dive is an *exact* match, which works well when you have a single dive computer, but is a big pain when you have multiple. What happens is that the date of the dive will be determined by whatever dive computer you used first, and then downloading from other dive computers will not match exactly, but will merge (if the computers are within a minute of each other). And that will continue to happen every time you try to download from that other dive computer. So use the same logic as for the automatic dive merging: consider "within one minute" to be a matching dive. So don't download dives that will be merged - unless the user asks for it. We do want to have some way of saying "force download of all dives from today" or something like that, I suspect. Because while I don't want to re-download *every* dive, I might want to force-merge the last <N> dives. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
cfaa494452
commit
2c3850110b
1 changed files with 3 additions and 1 deletions
|
@ -193,7 +193,9 @@ static int find_dive(struct dive *dive, device_data_t *devdata)
|
|||
for (i = 0; i < dive_table.preexisting; i++) {
|
||||
struct dive *old = dive_table.dives[i];
|
||||
|
||||
if (dive->when != old->when)
|
||||
if (dive->when > old->when + 60)
|
||||
continue;
|
||||
if (dive->when + 60 < old->when)
|
||||
continue;
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue