diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-09-07 10:12:31 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-09-07 10:12:31 -0700 |
commit | b49b081bb9c3938e5df201350a3a7d397c2c6216 (patch) | |
tree | 0fb28dc9756f18ce13011e5754882c789f444cf9 /dive.h | |
parent | 6ddf0e1d227bdf707469a2d7313ea850d35a6cda (diff) | |
download | subsurface-b49b081bb9c3938e5df201350a3a7d397c2c6216.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r-- | dive.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -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) |