Be stricter about when we allow merging of dives

If the surface interval between two dives is more than half an hour,
don't try to call it a single dive.  Just the dive profile will be
looking ridiculous.

Things like tank refills etc could also be a good thing to check (again,
the dive profile would look ridiculous), but the cylinder pressure going
up a small amount is actually normal (ie cylinder warming up in warmer
water on the surface).  So I don't know what the proper limit for that
would be.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2012-11-11 15:02:50 +01:00 committed by Dirk Hohndel
parent 80485114ba
commit b304562fa8

View file

@ -2118,16 +2118,25 @@ static void merge_dives_cb(GtkWidget *menuitem, void *unused)
/* Called if there are exactly two selected dives and the dive at idx is one of them */
static void add_dive_merge_label(int idx, GtkMenuShell *menu)
{
struct dive *d;
struct dive *a, *b;
GtkWidget *menuitem;
/* The other selected dive must be next to it.. */
if (!((d = get_dive(idx-1)) && d->selected) &&
!((d = get_dive(idx+1)) && d->selected))
return;
a = get_dive(idx);
b = get_dive(idx+1);
if (!b || !b->selected) {
b = a;
a = get_dive(idx-1);
if (!a || !a->selected)
return;
}
/* .. and they had better be in the same dive trip */
if (d->divetrip != get_dive(idx)->divetrip)
if (a->divetrip != b->divetrip)
return;
/* .. and if the surface interval is excessive, you must be kidding us */
if (b->when > a->when + a->duration.seconds + 30*60)
return;
/* If so, we can add a "merge dive" menu entry */