From b49b081bb9c3938e5df201350a3a7d397c2c6216 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 7 Sep 2012 10:12:31 -0700 Subject: Handle new dives correctly if trips exist There is an interesting issue when adding new dives into a dive list with existing trips. Since fill_dive_list walks the list backwards and trips are determined by the timestamp of the first dive in a trip, it is non-trivial to know when a dive is added if it should be part of an existing trip or not. Let's say when we see the dive we can also see a trip entry that starts four days earlier. Without looking forward in the list of dives we cannot tell if this is a multi-day trip that this dive would fit into, or if there is a break of more than tree days (our current trip threshold). Instead this commit adds a second scan of the dives in chronological order that does the right thing for new dives. Signed-off-by: Dirk Hohndel --- dive.h | 1 + 1 file changed, 1 insertion(+) (limited to 'dive.h') diff --git a/dive.h b/dive.h index 29814c34e..42b5f771d 100644 --- a/dive.h +++ b/dive.h @@ -271,6 +271,7 @@ extern gboolean autogroup; #define UNGROUPED_DIVE(_dive) ((_dive)->tripflag == NO_TRIP) #define DIVE_IN_TRIP(_dive) ((_dive)->tripflag == IN_TRIP) +#define DIVE_NEEDS_TRIP(_dive) ((_dive)->tripflag == TF_NONE) #define NEXT_TRIP(_entry) ((_entry) ? g_list_next(_entry) : (dive_trip_list)) #define PREV_TRIP(_entry) ((_entry) ? g_list_previous(_entry) : g_list_last(dive_trip_list)) #define DIVE_TRIP(_trip) ((struct dive *)(_trip)->data) -- cgit v1.2.3-70-g09d2