1. Benoît Allard
  2. buglink

Commits

Benoît Allard  committed cce43af

web: reverse the ordering on some queries to get the most relevant results on the first pages

  • Participants
  • Parent commits 4868d26
  • Branches default

Comments (0)

Files changed (1)

File web/views.py

View file
  • Ignore whitespace
 @views.route('/issues/', defaults={'page': 1})
 @views.route('/issues/page/<int:page>')
 def listissues(page):
-    query = request.dbsession.query(models.Issue).order_by(models.Issue.ref)
+    query = request.dbsession.query(models.Issue). \
+                              order_by(models.Issue.ref.desc())
     items = query.limit(PER_PAGE).offset((page - 1) * PER_PAGE).all()
     if not items and page != 1:
         abort(404)
 @views.route('/builds/page/<int:page>')
 def listbuilds(page):
     query = request.dbsession.query(models.Build) \
-                             .order_by(models.Build.number)
+                             .order_by(models.Build.number.desc())
     items = query.limit(PER_PAGE).offset((page - 1) * PER_PAGE).all()
     if not items and page != 1:
         abort(404)
 @views.route('/releases/page/<int:page>')
 def listreleases(page):
     query = request.dbsession.query(models.Release) \
-                             .order_by(models.Release.ref) \
-                             .order_by(models.Release.rc)
+                             .order_by(models.Release.ref.desc()) \
+                             .order_by(models.Release.rc.desc())
     items = query.limit(PER_PAGE).offset((page - 1) * PER_PAGE).all()
     if not items and page != 1:
         abort(404)