Browse Source

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

Dan Helfman 9 years ago
parent
commit
96456efd76
3 changed files with 23 additions and 16 deletions
  1. 4
    0
      NEWS
  2. 18
    15
      controller/test/Test_notebooks.py
  3. 1
    1
      model/Notebook.py

+ 4
- 0
NEWS View File

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

+ 18
- 15
controller/test/Test_notebooks.py View File

@@ -4632,19 +4632,20 @@ class Test_notebooks( Test_controller ):
4632 4632
     notes = result.get( "notes" )
4633 4633
     assert len( notes ) == self.database.select_one( int, self.notebook.sql_count_notes() )
4634 4634
     startup_note_allowed = True
4635
-    previous_revision = None
4635
+    previous_rank = True
4636 4636
 
4637
-    # assert that startup notes come first, then normal notes in alphabetical order
4637
+    # assert that startup notes come first, then normal notes. each group should be ordered by rank
4638 4638
     for note in notes:
4639 4639
       if note.startup:
4640 4640
         assert startup_note_allowed
4641 4641
       else:
4642
+        previous_rank = None
4642 4643
         startup_note_allowed = False
4643 4644
 
4644
-        if previous_revision:
4645
-          assert note.revision < previous_revision
4645
+        if previous_rank:
4646
+          assert note.rank >= previous_rank
4646 4647
 
4647
-        previous_revision = note.revision
4648
+        previous_rank = note.rank
4648 4649
 
4649 4650
       db_note = self.database.load( Note, note.object_id )
4650 4651
       assert db_note
@@ -4712,9 +4713,9 @@ class Test_notebooks( Test_controller ):
4712 4713
     expected_note_count = self.database.select_one( int, self.notebook.sql_count_notes() )
4713 4714
     note_count = 0
4714 4715
     startup_note_allowed = True
4715
-    previous_revision = None
4716
+    previous_rank = None
4716 4717
 
4717
-    # assert that startup notes come first, then normal notes in alphabetical order
4718
+    # assert that startup notes come first, then normal notes. each group should be ordered by rank
4718 4719
     for row in reader:
4719 4720
       note_count += 1
4720 4721
 
@@ -4724,12 +4725,13 @@ class Test_notebooks( Test_controller ):
4724 4725
       if startup:
4725 4726
         assert startup_note_allowed
4726 4727
       else:
4728
+        previous_rank = None
4727 4729
         startup_note_allowed = False
4728 4730
 
4729
-        if previous_revision:
4730
-          assert revision_date < previous_revision
4731
+        if previous_rank:
4732
+          assert note.rank >= previous_rank
4731 4733
 
4732
-        previous_revision = revision_date
4734
+        previous_rank = note.rank
4733 4735
 
4734 4736
       db_note = self.database.load( Note, note_id )
4735 4737
       assert db_note
@@ -4788,19 +4790,20 @@ class Test_notebooks( Test_controller ):
4788 4790
     notes = result.get( "notes" )
4789 4791
     assert len( notes ) == self.database.select_one( int, self.notebook.sql_count_notes() )
4790 4792
     startup_note_allowed = True
4791
-    previous_revision = None
4793
+    previous_rank = None
4792 4794
 
4793
-    # assert that startup notes come first, then normal notes in alphabetical order
4795
+    # assert that startup notes come first, then normal notes. each group should be ordered by rank
4794 4796
     for note in notes:
4795 4797
       if note.startup:
4796 4798
         assert startup_note_allowed
4797 4799
       else:
4800
+        previous_rank = None
4798 4801
         startup_note_allowed = False
4799 4802
 
4800
-        if previous_revision:
4801
-          assert note.revision < previous_revision
4803
+        if previous_rank:
4804
+          assert note.rank >= previous_rank
4802 4805
 
4803
-        previous_revision = note.revision
4806
+        previous_rank = note.rank
4804 4807
 
4805 4808
       db_note = self.database.load( Note, note.object_id )
4806 4809
       assert db_note

+ 1
- 1
model/Notebook.py View File

@@ -172,7 +172,7 @@ class Notebook( Persistent ):
172 172
     """
173 173
     Return a SQL string to load a list of the non-startup notes within this notebook.
174 174
     """
175
-    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 )
175
+    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 )
176 176
 
177 177
   def sql_load_startup_notes( self ):
178 178
     """