You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/06/27 00:56:58 UTC

[03/11] git commit: [#5650] ticket:323 Fix ordering in paginated results

[#5650] ticket:323 Fix ordering in paginated results


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/98669129
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/98669129
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/98669129

Branch: refs/heads/master
Commit: 9866912972b3939023fc9e94fd934a5adfb3fef9
Parents: 44ad385
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue May 7 10:23:35 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Jun 26 22:56:12 2013 +0000

----------------------------------------------------------------------
 ForgeDiscussion/forgediscussion/controllers/root.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/98669129/ForgeDiscussion/forgediscussion/controllers/root.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/root.py b/ForgeDiscussion/forgediscussion/controllers/root.py
index 1f577f2..11d6c6c 100644
--- a/ForgeDiscussion/forgediscussion/controllers/root.py
+++ b/ForgeDiscussion/forgediscussion/controllers/root.py
@@ -228,7 +228,7 @@ class RootRestController(BaseController):
         forums = model.Forum.query.find(dict(
                         app_config_id=c.app.config._id,
                         parent_id=None, deleted=False)
-                ).skip(start).limit(limit)
+                ).sort([('shortname', pymongo.ASCENDING)]).skip(start).limit(limit)
         count = forums.count()
         json = dict(forums=[dict(_id=f._id,
                                  name=f.name,
@@ -334,13 +334,11 @@ class ForumTopicRestController(BaseController):
     @expose('json:')
     def index(self, limit=100, page=0, **kw):
         limit, page, start = g.handle_paging(int(limit), int(page))
-        posts = model.ForumPost.query.find(dict(thread_id=self.topic._id))
-        posts = posts.skip(start).limit(limit)
-        count = posts.count()
+        posts = self.topic.query_posts(page=page, limit=limit, style='')
         json = {}
         json['topic'] = self.topic.__json__()
-        json['topic']['posts'] = posts.all()
-        json['count'] = count
+        json['count'] = posts.count()
         json['page'] = page
         json['limit'] = limit
+        json['topic']['posts'] = posts.all()
         return json