mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Properly handle user dive merge requests
When the user asks to merge dives in the divelist, we would always use the "try tp find matching dive computers and merge at an offset" model. That is incorrect if the intent is to actually merge two *identical* dives (with different dive computers), as opposed to merging two short dives into one longer one with a surface interval. Normally this doesn't ever trigger (the "same dive" merging will have been done automatically after downloading from the dive computer), but if the dive computer times are off, and the user fixes them, and then asks to merge dives, we should use the non-offset dive merging logic. We already have that "likely_same_dive()" function that is used to determine when downloaded dives get merged, so just use it for the user merge case too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a8c0bf3e57
commit
9fca37acec
1 changed files with 8 additions and 0 deletions
8
dive.c
8
dive.c
|
@ -2064,6 +2064,14 @@ struct dive *merge_dives(struct dive *a, struct dive *b, int offset, bool prefer
|
|||
if (prefer_downloaded && b->downloaded)
|
||||
dl = b;
|
||||
|
||||
/*
|
||||
* Did the user ask us to merge dives in the dive list?
|
||||
* We may want to just join the dive computers, not try to
|
||||
* interleave them at some offset.
|
||||
*/
|
||||
if (offset && likely_same_dive(a, b))
|
||||
offset = 0;
|
||||
|
||||
res->when = dl ? dl->when : a->when;
|
||||
res->selected = a->selected || b->selected;
|
||||
merge_trip(res, a, b);
|
||||
|
|
Loading…
Add table
Reference in a new issue