Browse Source

Better sort popular threads.

Ralfp 12 years ago
parent
commit
54586035bd
2 changed files with 2 additions and 2 deletions
  1. 1 1
      misago/apps/index.py
  2. 1 1
      misago/apps/popularthreads.py

+ 1 - 1
misago/apps/index.py

@@ -12,7 +12,7 @@ def index(request):
         popular_threads = cache.get('thread_ranking_%s' % request.user.make_acl_key(), 'nada')
         if popular_threads == 'nada':
             popular_threads = []
-            for thread in Thread.objects.filter(moderated=False).filter(deleted=False).filter(forum__in=Forum.objects.readable_forums(request.acl)).prefetch_related('forum').order_by('-score')[:request.settings['thread_ranking_size']]:
+            for thread in Thread.objects.filter(moderated=False).filter(deleted=False).filter(forum__in=Forum.objects.readable_forums(request.acl)).prefetch_related('forum').order_by('-score', '-last')[:request.settings['thread_ranking_size']]:
                 thread.forum_name = thread.forum.name
                 thread.forum_slug = thread.forum.slug
                 popular_threads.append(thread)

+ 1 - 1
misago/apps/popularthreads.py

@@ -15,7 +15,7 @@ def popular_threads(request, page=0):
     except Http404:
         return redirect(reverse('popular_threads'))
 
-    queryset = queryset.order_by('-score').prefetch_related('forum')[pagination['start']:pagination['stop']];
+    queryset = queryset.order_by('-score', '-last').prefetch_related('forum')[pagination['start']:pagination['stop']];
     if request.settings['avatars_on_threads_list']:
         queryset = queryset.prefetch_related('start_poster', 'last_poster')