RFC: sort 'dive number' column by date, not number

Dirk Hohndel dirk at hohndel.org
Sat Jun 8 20:44:49 PDT 2013


On Sat, 2013-06-08 at 17:58 -0700, Linus Torvalds wrote:
> Ok, so this sounds insane, but it fixes our currently broken sorting
> of dive trips vs plain dives not in trips.
> 
> The reason for that is simple: the dive trips are sorted by date, but
> that's column #0, and for plain dives is the dive number.
> 
> So currently the trip-vs-dive sorting looks at the date of the trip,
> and compares that to the number of the dive. Since the date of the
> trip is expressed as seconds-since-1970-in-UTC, unsurprisingly the
> dive number is generally much smaller (even for some very avid divers
> ;), and so the plain dives end up sorting way at the bottom (or at the
> top, if you do "oldest trips first"
> 
> Since the dive number *should* sort as the date, this stupid attached
> patch just makes us return the dive date instead.

Brilliant in its simplicity. It will confuse the heck out of people who
for odd reasons want to number their dives in a non-chronological way,
but one could argue that they need medical help, anyway...

> Now, there are other possible solutions to this:
> 
>  - make the date of the dive be column 0, and make the dive number be column 1.

Yuck. That's ugly and very unintuitive.

>    Quite frankly, while more logical for this particular problem, it
> probably sucks as a solution. We do want to have a column we can sort
> dives by that is date-based, but doesn't include trips. And while the
> dive number *should* sort identically to the date one, the fact is
> that you can have dives without any numbering, so it doesn't.
> 
>    In contrast, all dives have dates, and sorting numbered dives by
> date should still result in sane behavior (and if it doesn't, then the
> insanity comes from the dive numbering, and odd sorting is the fault
> of the user and indicative of a problem)

It's rare that I agree with reasoning that says "it's the users' fault",
but yes... if your dive numbers are not chronological... I really can't
help you.

>  - We could possibly do something magical like sorting dives by number
> when they are inside trips, or when no trips exist at all. But then
> we'd sort by date when there are trips and the dive is outside the
> trip. But quite frankly, that just sounds insane.

Yes and it's not self-consistent. I don't like that at all.

> So on the whole, I don't love this patch, but it seems to be the least
> confusing of the possibilities.

I'll take it.

/D




More information about the subsurface mailing list