← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~nigelbabu/launchpad/789222-sort-fix into lp:launchpad

 

Nigel Babu has proposed merging lp:~nigelbabu/launchpad/789222-sort-fix into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #789222 in Launchpad itself: "Sprints and specification subscribers are really not alphabetically sorted"
  https://bugs.launchpad.net/launchpad/+bug/789222

For more details, see:
https://code.launchpad.net/~nigelbabu/launchpad/789222-sort-fix/+merge/62739

The "fix" for sorting sprint attendees and specification subscribers didn't work correctly. Fixing that.
-- 
https://code.launchpad.net/~nigelbabu/launchpad/789222-sort-fix/+merge/62739
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~nigelbabu/launchpad/789222-sort-fix into lp:launchpad.
=== modified file 'lib/lp/blueprints/model/sprint.py'
--- lib/lp/blueprints/model/sprint.py	2011-05-23 01:01:39 +0000
+++ lib/lp/blueprints/model/sprint.py	2011-05-27 21:26:01 +0000
@@ -314,7 +314,7 @@
         # result set.  Listification should do.
         list(getUtility(IPersonSet).getPrecachedPersonsFromIDs(
                 people, need_validity=True))
-        return sorted(result, key=lambda a: a.attendee.displayname)
+        return sorted(result, key=lambda a: a.attendee.displayname.lower())
 
     # linking to specifications
     def linkSpecification(self, spec):

=== modified file 'lib/lp/blueprints/model/tests/test_sprint.py'
--- lib/lp/blueprints/model/tests/test_sprint.py	2011-05-19 17:48:05 +0000
+++ lib/lp/blueprints/model/tests/test_sprint.py	2011-05-27 21:26:01 +0000
@@ -17,11 +17,14 @@
         #Test the sorting of attendances to be by displayname rather than name
         sprint = self.factory.makeSprint()
         bob = self.factory.makePerson(name='zbob', displayname='Bob')
+        ced = self.factory.makePerson(name='xed', displayname='ced')
         dave = self.factory.makePerson(name='wdave', displayname='Dave')
         sprint.attend(
             bob, sprint.time_starts, sprint.time_ends, True)
         sprint.attend(
+            ced, sprint.time_starts, sprint.time_ends, True)
+        sprint.attend(
             dave, sprint.time_starts, sprint.time_ends, True)
-        attendances = [bob.displayname, dave.displayname]
+        attendances = [bob.displayname, ced.displayname, dave.displayname]
         people = [attendee.attendee.displayname for attendee in sprint.attendances]
         self.assertEqual(attendances, people)