From 38fb49edd27fc4fb35fa047158a20025e9959724 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 9cd61e3..53517db 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 bfe730a..bec00b9 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