Last Comment Bug 755796 - Contacts API: multiple sorting fields
: Contacts API: multiple sorting fields
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: Device Interfaces (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: mozilla15
Assigned To: Gregor Wagner [:gwagner]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-16 09:47 PDT by Gregor Wagner [:gwagner]
Modified: 2012-05-24 09:30 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (2.87 KB, patch)
2012-05-16 13:44 PDT, Gregor Wagner [:gwagner]
no flags Details | Diff | Splinter Review
patch (3.01 KB, patch)
2012-05-16 13:48 PDT, Gregor Wagner [:gwagner]
no flags Details | Diff | Splinter Review
patch (3.69 KB, patch)
2012-05-21 15:46 PDT, Gregor Wagner [:gwagner]
fabrice: review+
Details | Diff | Splinter Review

Description Gregor Wagner [:gwagner] 2012-05-16 09:47:56 PDT
We currently only sort by either first or family name. If 2 entries have the same familyName for example we want to continue sorting based on the first name.
Comment 1 Gregor Wagner [:gwagner] 2012-05-16 13:44:07 PDT
Created attachment 624514 [details] [diff] [review]
patch
Comment 2 Gregor Wagner [:gwagner] 2012-05-16 13:48:32 PDT
Created attachment 624516 [details] [diff] [review]
patch
Comment 3 Gregor Wagner [:gwagner] 2012-05-21 15:46:20 PDT
Created attachment 625799 [details] [diff] [review]
patch

There was a bug in the first version. Entries can be undefined.
Comment 4 [:fabrice] Fabrice Desré 2012-05-23 09:37:14 PDT
Comment on attachment 625799 [details] [diff] [review]
patch

Review of attachment 625799 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with comments addressed

::: dom/contacts/fallback/ContactService.jsm
@@ +89,5 @@
> +      }
> +
> +      if (sortByNameSet) {
> +        result = x.localeCompare(y);
> +      }

nit: add blank line

@@ +106,1 @@
>        return msg.findOptions.sortOrder == 'ascending' ? result : -result;

Do a |let sortOrder = msg.findOptions.sortOrder| like for sortBy and reuse it.
Comment 6 Ed Morley [:emorley] 2012-05-24 09:30:21 PDT
https://hg.mozilla.org/mozilla-central/rev/d529197a47f0

Note You need to log in before you can comment on or make changes to this bug.