aboutsummaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/core/dive.c b/core/dive.c
index d6fba1714..22f88d43f 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -2578,24 +2578,21 @@ static const struct dive *get_preferred_trip(const struct dive *a, const struct
{
dive_trip_t *atrip, *btrip;
- /*
- * The larger tripflag is more relevant: we prefer
- * take manually assigned trips over auto-generated
- * ones.
- */
- if (a->tripflag > b->tripflag)
- return a;
-
- if (a->tripflag < b->tripflag)
- return b;
-
- /* Otherwise, look at the trip data and pick the "better" one */
+ /* If only one dive has a trip, choose that */
atrip = a->divetrip;
btrip = b->divetrip;
if (!atrip)
return b;
if (!btrip)
return a;
+
+ /* Both dives have a trip - prefer the non-autogenerated one */
+ if (atrip->autogen && !btrip->autogen)
+ return b;
+ if (!atrip->autogen && btrip->autogen)
+ return a;
+
+ /* Otherwise, look at the trip data and pick the "better" one */
if (!atrip->location)
return b;
if (!btrip->location)