mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-25 15:39:11 +00:00
Cleaning up person_view sorts (#2760)
This commit is contained in:
parent
80571567e1
commit
4c77c84b60
|
@ -95,17 +95,12 @@ impl<'a> PersonQuery<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
query = match self.sort.unwrap_or(SortType::Hot) {
|
query = match self.sort.unwrap_or(SortType::Hot) {
|
||||||
SortType::Hot => query
|
SortType::New | SortType::NewComments => query.order_by(person::published.desc()),
|
||||||
.order_by(person_aggregates::comment_score.desc())
|
|
||||||
.then_order_by(person::published.desc()),
|
|
||||||
SortType::Active => query
|
|
||||||
.order_by(person_aggregates::comment_score.desc())
|
|
||||||
.then_order_by(person::published.desc()),
|
|
||||||
SortType::New | SortType::MostComments | SortType::NewComments => {
|
|
||||||
query.order_by(person::published.desc())
|
|
||||||
}
|
|
||||||
SortType::Old => query.order_by(person::published.asc()),
|
SortType::Old => query.order_by(person::published.asc()),
|
||||||
SortType::TopAll => query.order_by(person_aggregates::comment_score.desc()),
|
SortType::Hot | SortType::Active | SortType::TopAll => {
|
||||||
|
query.order_by(person_aggregates::comment_score.desc())
|
||||||
|
}
|
||||||
|
SortType::MostComments => query.order_by(person_aggregates::comment_count.desc()),
|
||||||
SortType::TopYear => query
|
SortType::TopYear => query
|
||||||
.filter(person::published.gt(now - 1.years()))
|
.filter(person::published.gt(now - 1.years()))
|
||||||
.order_by(person_aggregates::comment_score.desc()),
|
.order_by(person_aggregates::comment_score.desc()),
|
||||||
|
|
Loading…
Reference in a new issue