Ordering leaderboard by score and truncating at 20
authorBryan Bonvallet <btbonval@gmail.com>
Fri, 20 Dec 2013 20:59:44 +0000 (15:59 -0500)
committerBryan Bonvallet <btbonval@gmail.com>
Fri, 20 Dec 2013 20:59:44 +0000 (15:59 -0500)
karmaworld/apps/courses/views.py

index 8f8d84e3dc9d42f2b19339989055d5a3fa14ff91..1bd64ee0a1442dadb27565f47c443536485e6311 100644 (file)
@@ -83,7 +83,7 @@ class AboutView(TemplateView):
     def get_context_data(self, **kwargs):
         """ get the list of schools with the most files for leaderboard """
         context = { 'params': kwargs,
-                    'schools': School.objects.filter(file_count__gt=0).order_by('name') }
+                    'schools': School.objects.filter(file_count__gt=0).order_by('file_count')[:20] }
         return context