Discussion:
Contributing dive computer alert data
Joel Ekström
2018-09-11 14:41:38 UTC
Permalink
Hey everyone! Just discovered Subsurface and I really like the software.
I decided to try to make a contribution, and a seemingly simple one was
to add some info for missing alerts for my dive computer.
This took me to the file 'import-suunto.c' where the names of alerts are
converted from numbers into the text shown in Subsurface.
Adding the missing ones is a simple matter. However, it won't show up
retroactively in existing logs, since this data is created during import
(I assume).
How would one go about fixing this retroactively? Storing the alert as a
string directly in the database files seems like an odd decision to me
(although I'm sure there are good reasons for this). Instead I would've
assumed that there would be some kind of lookup table for alerts that is
queried as the UI is drawn.
I'd appreciate some advice and discussion about this (preferably about
how I'm approaching this from a totally wrong angle).
Thanks!
Anton Lundin
2018-09-11 16:46:11 UTC
Permalink
Post by Joel Ekström
Hey everyone! Just discovered Subsurface and I really like the software.
I decided to try to make a contribution, and a seemingly simple one was
to add some info for missing alerts for my dive computer.
This took me to the file 'import-suunto.c' where the names of alerts are
converted from numbers into the text shown in Subsurface.
Adding the missing ones is a simple matter. However, it won't show up
retroactively in existing logs, since this data is created during import
(I assume).
How would one go about fixing this retroactively? Storing the alert as a
string directly in the database files seems like an odd decision to me
(although I'm sure there are good reasons for this). Instead I would've
assumed that there would be some kind of lookup table for alerts that is
queried as the UI is drawn.
I'd appreciate some advice and discussion about this (preferably about
how I'm approaching this from a totally wrong angle).
Hi.

Subsurface store the different events as strings. This is because we
support multiple different computers from different manufacturers, and
if we kept the original id's and map'ed events that way, we would have
unsolvable overlaps. Some DC's doesn't even use ID's to denote events,
so strings describing the event becomes the common denominator.


I'd suggest that the way for you to add your new events to your existing
logbook is to re-import the data from your suunto dm file, and then
merge that with your existing logbook. This can be done by hand with a
simple diff tool, if you use the xml format, or save the data as a
separate branch in your git data repo, and then merge that branch into
your logbook, adding those events to the existing dives.
Others might chime in with different ideas on how to solve this.


//Anton
--
Anton Lundin +46702-161604
Loading...