From 8955633a3b3e024ba285ba82060346aa9abe152c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 19 Jun 2019 16:10:05 -0700 Subject: [PATCH] Ordering by date second. - Fixes #175 --- server/src/db/comment_view.rs | 2 +- server/src/db/post_view.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/db/comment_view.rs b/server/src/db/comment_view.rs index 9cd61e33..53517db9 100644 --- a/server/src/db/comment_view.rs +++ b/server/src/db/comment_view.rs @@ -94,7 +94,7 @@ impl CommentView { } query = match sort { - // SortType::Hot => query.order_by(hot_rank.desc()), + // SortType::Hot => query.order(hot_rank.desc(), published.desc()), SortType::New => query.order_by(published.desc()), SortType::TopAll => query.order_by(score.desc()), SortType::TopYear => query diff --git a/server/src/db/post_view.rs b/server/src/db/post_view.rs index bfe730a2..bec00b98 100644 --- a/server/src/db/post_view.rs +++ b/server/src/db/post_view.rs @@ -122,7 +122,8 @@ impl PostView { } query = match sort { - SortType::Hot => query.order_by(hot_rank.desc()), + SortType::Hot => query.order_by(hot_rank.desc()) + .then_order_by(published.desc()), SortType::New => query.order_by(published.desc()), SortType::TopAll => query.order_by(score.desc()), SortType::TopYear => query -- 2.44.1