sort order time desc by default

This commit is contained in:
yggverse 2025-08-06 12:09:52 +03:00
parent 57ab9ef1f5
commit 1d64acef2c
2 changed files with 4 additions and 4 deletions

View file

@ -48,7 +48,7 @@ fn index(
} }
let (total, torrents) = storage let (total, torrents) = storage
.torrents( .torrents(
Some((Sort::Modified, Order::Asc)), Some((Sort::Modified, Order::Desc)),
page.map(|p| if p > 0 { p - 1 } else { p } * storage.default_limit), page.map(|p| if p > 0 { p - 1 } else { p } * storage.default_limit),
Some(storage.default_limit), Some(storage.default_limit),
) )
@ -91,7 +91,7 @@ fn rss(feed: &State<Feed>, storage: &State<Storage>) -> Result<RawXml<String>, C
let mut b = feed.transaction(1024); // @TODO let mut b = feed.transaction(1024); // @TODO
for torrent in storage for torrent in storage
.torrents( .torrents(
Some((Sort::Modified, Order::Asc)), Some((Sort::Modified, Order::Desc)),
None, None,
Some(storage.default_limit), Some(storage.default_limit),
) )

View file

@ -16,7 +16,7 @@ pub enum Sort {
pub enum Order { pub enum Order {
#[default] #[default]
Asc, Asc,
//Desc, Desc,
} }
#[derive(Clone, Debug, Serialize)] #[derive(Clone, Debug, Serialize)]
@ -186,7 +186,7 @@ impl Storage {
match sort { match sort {
Sort::Modified => match order { Sort::Modified => match order {
Order::Asc => b.sort_by(|a, b| a.0.cmp(&b.0)), 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)),
}, },
} }
} }