Merge pull request #1537 from LemmyNet/add_users_active_monthly_community_sort

Adding users active monthly for community sort. Fixes #1527
pull/1559/head
Nutomic 2021-04-06 12:03:11 +00:00 committed by GitHub
commit a4c2421e74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 0 deletions

View File

@ -193,6 +193,7 @@ impl<'a> CommunityQueryBuilder<'a> {
match self.sort {
SortType::New => query = query.order_by(community::published.desc()),
SortType::TopAll => query = query.order_by(community_aggregates::subscribers.desc()),
SortType::TopMonth => query = query.order_by(community_aggregates::users_active_month.desc()),
// Covers all other sorts, including hot
_ => {
query = query

View File

@ -0,0 +1 @@
drop index idx_community_aggregates_users_active_month;

View File

@ -0,0 +1,2 @@
create index idx_community_aggregates_users_active_month on community_aggregates (users_active_month desc);