repolist.c - fix sorting by "Last Modified" column
(1.1) By PF (peter) on 2022-04-24 20:13:28 edited from 1.0 [source]
I was unable to correctly sort repos on my repolist page.
Human readable time of last repo change was OK but there were visible several entries with data-sortkey='00000000'
and alike in repolist html source.
For me, ordering was corrected by simple patch1 in repolist.c
Thank you for fossil/SQLite and all its amazing features.
EDIT: fix link to repolist.c
- ^
Simple patch to correct ordering of repolist entries by "Last Modified" column
Index: src/repolist.c ================================================================== --- src/repolist.c +++ src/repolist.c @@ -210,11 +210,11 @@ if( rNow <= x.rMTime ){ x.rMTime = rNow; }else if( x.rMTime<0.0 ){ x.rMTime = rNow; } - iAge = (int)(rNow - x.rMTime)*86400; + iAge = (double)(rNow - x.rMTime)*86400; zAge = human_readable_age(rNow - x.rMTime); if( x.rMTime==0.0 ){ /* This repository has no entry in the "event" table. ** Its age will still be maximum, so data-sortkey will work. */ zAge = mprintf("unknown");
(2) By Stephan Beal (stephan) on 2022-04-24 22:46:00 in reply to 1.1 [link] [source]
For me, ordering was corrected by simple patch ...
Thank you, that's now applied on trunk.
PS: that's a nice use of the new footnotes feature.
(3) By Brian Tiffin (btiffin) on 2022-04-25 00:17:16 in reply to 2 [link] [source]
As a drive-by comment. That's not the final code though, right?
Casting to (double)
seems a little suspect. It just needs to be a wider integer? Like the sqlite3_int64
I'm seeing from the last fossil up
?
Cheers
(4) By Stephan Beal (stephan) on 2022-04-25 12:56:10 in reply to 3 [link] [source]
Casting to (double) seems a little suspect. It just needs to be a wider integer? Like the sqlite3_int64 I'm seeing from the last fossil up?
Indeed, Richard fixed that while i was off sleeping. That's what i get for coding after midnight local time.