witten
/
luminotes
Archived
1
0
Fork 0

Fixed a bug in which some printed or exported notes appeared in alphabetical order instead of your chosen ordering.

This commit is contained in:
Dan Helfman 2009-06-14 21:45:08 -07:00
parent 1b3e0478ed
commit 96456efd76
3 changed files with 23 additions and 16 deletions

4
NEWS
View File

@ -1,3 +1,7 @@
1.6.14: June 14, 2009
* Fixed a bug in which some printed or exported notes appeared in
alphabetical order instead of your chosen ordering.
1.6.13: May 20, 2009 1.6.13: May 20, 2009
* Added a dynamic preview of your current color selections to the color * Added a dynamic preview of your current color selections to the color
picker. This lets you see what the selected colors will look like as you picker. This lets you see what the selected colors will look like as you

View File

@ -4632,19 +4632,20 @@ class Test_notebooks( Test_controller ):
notes = result.get( "notes" ) notes = result.get( "notes" )
assert len( notes ) == self.database.select_one( int, self.notebook.sql_count_notes() ) assert len( notes ) == self.database.select_one( int, self.notebook.sql_count_notes() )
startup_note_allowed = True startup_note_allowed = True
previous_revision = None previous_rank = True
# assert that startup notes come first, then normal notes in alphabetical order # assert that startup notes come first, then normal notes. each group should be ordered by rank
for note in notes: for note in notes:
if note.startup: if note.startup:
assert startup_note_allowed assert startup_note_allowed
else: else:
previous_rank = None
startup_note_allowed = False startup_note_allowed = False
if previous_revision: if previous_rank:
assert note.revision < previous_revision assert note.rank >= previous_rank
previous_revision = note.revision previous_rank = note.rank
db_note = self.database.load( Note, note.object_id ) db_note = self.database.load( Note, note.object_id )
assert db_note assert db_note
@ -4712,9 +4713,9 @@ class Test_notebooks( Test_controller ):
expected_note_count = self.database.select_one( int, self.notebook.sql_count_notes() ) expected_note_count = self.database.select_one( int, self.notebook.sql_count_notes() )
note_count = 0 note_count = 0
startup_note_allowed = True startup_note_allowed = True
previous_revision = None previous_rank = None
# assert that startup notes come first, then normal notes in alphabetical order # assert that startup notes come first, then normal notes. each group should be ordered by rank
for row in reader: for row in reader:
note_count += 1 note_count += 1
@ -4724,12 +4725,13 @@ class Test_notebooks( Test_controller ):
if startup: if startup:
assert startup_note_allowed assert startup_note_allowed
else: else:
previous_rank = None
startup_note_allowed = False startup_note_allowed = False
if previous_revision: if previous_rank:
assert revision_date < previous_revision assert note.rank >= previous_rank
previous_revision = revision_date previous_rank = note.rank
db_note = self.database.load( Note, note_id ) db_note = self.database.load( Note, note_id )
assert db_note assert db_note
@ -4788,19 +4790,20 @@ class Test_notebooks( Test_controller ):
notes = result.get( "notes" ) notes = result.get( "notes" )
assert len( notes ) == self.database.select_one( int, self.notebook.sql_count_notes() ) assert len( notes ) == self.database.select_one( int, self.notebook.sql_count_notes() )
startup_note_allowed = True startup_note_allowed = True
previous_revision = None previous_rank = None
# assert that startup notes come first, then normal notes in alphabetical order # assert that startup notes come first, then normal notes. each group should be ordered by rank
for note in notes: for note in notes:
if note.startup: if note.startup:
assert startup_note_allowed assert startup_note_allowed
else: else:
previous_rank = None
startup_note_allowed = False startup_note_allowed = False
if previous_revision: if previous_rank:
assert note.revision < previous_revision assert note.rank >= previous_rank
previous_revision = note.revision previous_rank = note.rank
db_note = self.database.load( Note, note.object_id ) db_note = self.database.load( Note, note.object_id )
assert db_note assert db_note

View File

@ -172,7 +172,7 @@ class Notebook( Persistent ):
""" """
Return a SQL string to load a list of the non-startup notes within this notebook. Return a SQL string to load a list of the non-startup notes within this notebook.
""" """
return "select id, revision, title, contents, notebook_id, startup, deleted_from_id, rank, user_id from note_current where notebook_id = %s and startup = 'f' order by lower( title );" % quote( self.object_id ) return "select id, revision, title, contents, notebook_id, startup, deleted_from_id, rank, user_id from note_current where notebook_id = %s and startup = 'f' order by rank;" % quote( self.object_id )
def sql_load_startup_notes( self ): def sql_load_startup_notes( self ):
""" """