[PULL REQUEST] Delete multiple dives

Dirk Hohndel dirk at hohndel.org
Sun Sep 23 09:08:02 PDT 2012


On Sep 23, 2012, at 6:44 AM, Lubomir I. Ivanov wrote:

> On 23 September 2012 08:20, Dirk Hohndel <dirk at hohndel.org> wrote:
>> Not bad, but doesn't quite get it right, yet.
>> 
>> Think about the case where deleting dives changes the starting point of
>> a trip... it's important that at any point of time the dive_trip->when
>> == dive->when for the first (chronoligically) dive in a trip. So if you
>> delete the first trip you always need to update that start time of the
>> dive trip.
>> 
> 
> hopefully this solves the issue:

It kind of does, but I wonder if it wouldn't be better to use the existing helper functions for things like this.

Take a look at update_trip_timestamp() - it also shows you that you don't have to loop over the whole dive table as all you need to look at are the first and last child of the trip node in the tree model.

/D


More information about the subsurface mailing list