virittaa

Log | Files | Refs | README | LICENSE

commit e7b3d49450c49c0c58020ebc32625f5ae726aba7
parent e75cff3b66887e210a690a05183719b9ff2ce0bc
Author: mtmn <miro@haravara.org>
Date:   Thu, 14 May 2026 13:59:11 +0200

fix: print most recent at the bottom when listing

Diffstat:
Msrc/db.rs | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/db.rs b/src/db.rs @@ -268,7 +268,8 @@ impl LibraryDb { let effective_limit = if limit == 0 { usize::MAX } else { limit }; let mut results = Vec::new(); - // Iterate time index in reverse (most recent first) + // Iterate time index in reverse to collect the most recent entries first, + // then reverse so newest prints at the bottom. for item in self.time_tree.iter().rev() { if results.len() >= effective_limit { break; @@ -302,6 +303,7 @@ impl LibraryDb { } } + results.reverse(); Ok(results) } @@ -325,7 +327,7 @@ impl LibraryDb { } } - results.sort_by_key(|b| std::cmp::Reverse(b.1.timestamp)); + results.sort_by_key(|b| b.1.timestamp); results.truncate(limit); Ok(results) } @@ -350,7 +352,7 @@ impl LibraryDb { } } - results.sort_by_key(|b| std::cmp::Reverse(b.1.timestamp)); + results.sort_by_key(|b| b.1.timestamp); results.truncate(limit); Ok(results) } @@ -389,7 +391,7 @@ impl LibraryDb { } } - results.sort_by_key(|b| std::cmp::Reverse(b.1.timestamp)); + results.sort_by_key(|b| b.1.timestamp); results.truncate(limit); Ok(results) }