From 3e51057d2d39da3aa71ddcf22b37950d0339bc4c Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 28 Oct 2008 14:38:01 -0700 Subject: [PATCH] Order forum threads in reverse chronological order by creation date. --- controller/Forums.py | 4 +++- model/User.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/controller/Forums.py b/controller/Forums.py index e2813b6..9377c11 100644 --- a/controller/Forums.py +++ b/controller/Forums.py @@ -108,7 +108,6 @@ class Forum( object ): if anonymous is None: raise Access_error() - # TODO: this needs to sort by either thread/note creation or modification date threads = self.__database.select_many( Notebook, anonymous.sql_load_notebooks( @@ -116,6 +115,9 @@ class Forum( object ): ) ) + # put threads in reverse chronological order by creation date + threads.reverse() + # if there are no matching threads, then this forum doesn't exist if len( threads ) == 0: raise cherrypy.NotFound diff --git a/model/User.py b/model/User.py index 97d2c59..8ec52f4 100644 --- a/model/User.py +++ b/model/User.py @@ -182,7 +182,7 @@ class User( Persistent ): where user_notebook.user_id = %s%s%s%s%s%s and user_notebook.notebook_id = notebook_current.id - order by user_notebook.rank; + order by user_notebook.rank, notebook_current.revision; """ % ( tag_tables, quote( self.object_id ), parents_only_clause, undeleted_only_clause, read_write_clause, tag_clause, notebook_id_clause )