Bug: Cylinder editor doesn't honor sorting

Linus Torvalds torvalds at linux-foundation.org
Sun Dec 11 15:00:19 PST 2011


On Sun, Dec 11, 2011 at 12:27 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
> On Sun, Dec 11, 2011 at 12:00 PM, Henrik Brautaset Aronsen
> <subsurface at henrik.synth.no> wrote:
>> On 11.12.11 20:59, Linus Torvalds wrote:
>>>
>>> Hmm. The non-refresh is some old bug. And I guess we should do a
>>> separate He column, if only so that you can sort by trimix?
>>
>> Yeah, that makes sense.
>
> Actually, no it doesn't. We have bigger problems than "should we show
> Helium content". What about multi-cylinder dives?
>
> So I left it alone for now - some day we could use some fancy cell
> renderer to show multiple cylinder information [...]

Ok, so that "some day" is today.

This involved adding a custom sort function to the whole divelist
column mix, and that in turn required some setup changes to make it
clean enough, but it wasn't all *that* complicated. The end result may
be buggy, but it works in my testing, and looks reasonable.

So what happens now is that if you have trimix dives, the O2% column
will look like

    21/30

or similar, where the first number is Oxygen, and the second is
Helium. So the above would be an example single gas cylinder for deep
traveling (21% O2, 30% He).

But if you have multiple tanks, we'll show the maximum percentages
(per gas), so if you have a 50% Oxygen cylinder for your deco stop,
and a 70% Helium cylinder with 10% Oxygen for your deep phase, we'll
show

    50/70

for the mix, even though at no point did you obviously ever breath
*that* particular mix (getting 50% oxygen and 70% Helium into one
cylinder would be tricky just from a physics standpoint, never mind
the diving insanity of having a high-O2/high-He combination). But from
a "dive summary" standpoint, I think it makes sense to show the
maximum O2/He contents, even if they were in separate cylinders.

Because they show up in one column, it also requires some kind of
complex sorting. I made the rule simple: trimix is manlier than
nitrox, so even a low Helium percentage will sort as "bigger" than a
high Oxygen percentage.

So 21/70 > 30/30 > 50, even if the actual amount of oxygen is the
other way around. A higher He value will always sort higher, so even
if you were to just do some crazy "air with just 1% Helium", that
would sort higher than some pure oxygen deco bottle.

Basically it means that your trimix dives will always sort separately
from your other dives.

Comments? It seems to make sense and work in my very limited testing.

                       Linus


More information about the subsurface mailing list