adjusting newest to new internally

This commit is contained in:
aroberts-fox 2024-11-27 15:05:35 -05:00
parent 7b5de79d3f
commit 7aced03976
2 changed files with 2 additions and 2 deletions

View file

@ -1,5 +1,5 @@
<div class="btn-group mt-1 mb-2" aria-label="{{ _('Sorting methods: ') }}"> <div class="btn-group mt-1 mb-2" aria-label="{{ _('Sorting methods: ') }}">
<a href="/read-posts/newest" class="btn {{ 'btn-primary' if sort == 'newest' else 'btn-outline-secondary' }}" rel="nofollow noindex" title="{{ _('Newest posts') }}"> <a href="/read-posts/new" class="btn {{ 'btn-primary' if sort == 'new' else 'btn-outline-secondary' }}" rel="nofollow noindex" title="{{ _('Newest posts') }}">
{{ _('Newest') }} {{ _('Newest') }}
</a> </a>
<a href="/read-posts/oldest" class="btn {{ 'btn-primary' if sort == 'oldest' else 'btn-outline-secondary' }}" rel="nofollow noindex" title="{{ _('Oldest posts') }}"> <a href="/read-posts/oldest" class="btn {{ 'btn-primary' if sort == 'oldest' else 'btn-outline-secondary' }}" rel="nofollow noindex" title="{{ _('Oldest posts') }}">

View file

@ -1290,7 +1290,7 @@ def user_read_posts(sort=None):
posts = posts.order_by(desc(Post.sticky)).order_by(desc(Post.ranking)).order_by(desc(Post.posted_at)) posts = posts.order_by(desc(Post.sticky)).order_by(desc(Post.ranking)).order_by(desc(Post.posted_at))
elif sort == 'top': elif sort == 'top':
posts = posts.filter(Post.posted_at > utcnow() - timedelta(days=7)).order_by(desc(Post.sticky)).order_by(desc(Post.up_votes - Post.down_votes)) posts = posts.filter(Post.posted_at > utcnow() - timedelta(days=7)).order_by(desc(Post.sticky)).order_by(desc(Post.up_votes - Post.down_votes))
elif sort == 'newest': elif sort == 'new':
posts = posts.order_by(desc(Post.posted_at)) posts = posts.order_by(desc(Post.posted_at))
elif sort == 'oldest': elif sort == 'oldest':
posts = posts.order_by(asc(Post.posted_at)) posts = posts.order_by(asc(Post.posted_at))