From 1d64acef2c9ade5467743e6ef77f2772bd418a5d Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 6 Aug 2025 12:09:52 +0300 Subject: [PATCH] sort order time desc by default --- src/main.rs | 4 ++-- src/storage.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index dba35ba..e9f4341 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,7 +48,7 @@ fn index( } let (total, torrents) = storage .torrents( - Some((Sort::Modified, Order::Asc)), + Some((Sort::Modified, Order::Desc)), page.map(|p| if p > 0 { p - 1 } else { p } * storage.default_limit), Some(storage.default_limit), ) @@ -91,7 +91,7 @@ fn rss(feed: &State, storage: &State) -> Result, C let mut b = feed.transaction(1024); // @TODO for torrent in storage .torrents( - Some((Sort::Modified, Order::Asc)), + Some((Sort::Modified, Order::Desc)), None, Some(storage.default_limit), ) diff --git a/src/storage.rs b/src/storage.rs index 4db8182..a00b28f 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -16,7 +16,7 @@ pub enum Sort { pub enum Order { #[default] Asc, - //Desc, + Desc, } #[derive(Clone, Debug, Serialize)] @@ -186,7 +186,7 @@ impl Storage { match sort { Sort::Modified => match order { Order::Asc => b.sort_by(|a, b| a.0.cmp(&b.0)), - //Order::Desc => b.sort_by(|a, b| b.0.cmp(&a.0)), + Order::Desc => b.sort_by(|a, b| b.0.cmp(&a.0)), }, } }