Numerical categories are not sorted as numbers
Categories
(Calendar :: Tasks, defect)
Tracking
(Not tracked)
People
(Reporter: carleeto, Assigned: srujana121)
Details
(Keywords: polish, Whiteboard: [good first bug])
Attachments
(2 files, 2 obsolete files)
Comment 1•15 years ago
|
||
Comment 2•15 years ago
|
||
Reporter | ||
Comment 3•15 years ago
|
||
Comment 4•15 years ago
|
||
Comment 6•15 years ago
|
||
Comment 8•15 years ago
|
||
Comment 10•15 years ago
|
||
Reporter | ||
Comment 11•15 years ago
|
||
Comment 12•15 years ago
|
||
Comment 13•15 years ago
|
||
Updated•14 years ago
|
Comment 14•13 years ago
|
||
Updated•13 years ago
|
Updated•13 years ago
|
Updated•13 years ago
|
Comment 15•9 years ago
|
||
Comment 16•9 years ago
|
||
Comment 17•9 years ago
|
||
Comment 18•9 years ago
|
||
Comment 19•9 years ago
|
||
Comment 20•9 years ago
|
||
Comment 21•9 years ago
|
||
Comment 22•9 years ago
|
||
Comment 23•9 years ago
|
||
Comment 24•9 years ago
|
||
Comment 25•8 years ago
|
||
Comment 26•8 years ago
|
||
Updated•8 years ago
|
Updated•8 years ago
|
Comment 27•8 years ago
|
||
Updated•8 years ago
|
Comment 28•8 years ago
|
||
Updated•8 years ago
|
Comment 29•8 years ago
|
||
Comment 30•8 years ago
|
||
Comment 31•7 years ago
|
||
![]() |
||
Comment 32•7 years ago
|
||
Comment 33•7 years ago
|
||
Updated•7 years ago
|
Comment 34•7 years ago
|
||
Comment 35•7 years ago
|
||
Comment 36•7 years ago
|
||
Comment 37•7 years ago
|
||
Assignee | ||
Comment 38•6 years ago
|
||
Can I take up this bug?
Comment 39•6 years ago
|
||
Sure you can, hints in comment #33.
Assignee | ||
Comment 40•6 years ago
|
||
what's the expected output for this? 5 ,5abc ,6 ,7 ,56abc ,apple ,bat
Comment 41•6 years ago
|
||
Hi, did you just ask on IRC?
Doesn't "regular" compare just work? There's an approved patch here which uses localeCompare()
. The problem the patch had is that Locale.jsm doesn't exist any more but localeCompare()
still does. Sure, when you sort 1, 10, 2, 20 as strings you get: 1, 10, 2, 20. But that's always been the case. Am I missing something?
Assignee | ||
Comment 42•6 years ago
|
||
(In reply to Jorg K (GMT+1) from comment #41)
Hi, did you just ask on IRC?
Doesn't "regular" compare just work? There's an approved patch here which uses
localeCompare()
. The problem the patch had is that Locale.jsm doesn't exist any more butlocaleCompare()
still does. Sure, when you sort 1, 10, 2, 20 as strings you get: 1, 10, 2, 20. But that's always been the case. Am I missing something?
Yes, I just asked it on IRC. I think the OP feels that in case of only numbers it would be more intuitive to sort it in ascending order of numbers ie 1,2,10,20.
So if we were to implement that feature, what happens when there is a mixture of numbers and characters? Should I
a. put all the numbers first and then strings or
b. should I sort it as strings. Sort as numbers only when ever element is a number ?
Comment 43•6 years ago
|
||
Sorry, my comment #41 was pretty much nonsense :-( - Now I read the hole bug. Yes, this is about sorting the numbers correctly. Some suggestions were already made in comment #12.
However, the approved (and non-functional) patch uses localeCompare()
. Does that sort numbers correctly?
Assignee | ||
Comment 44•6 years ago
|
||
(In reply to Jorg K (GMT+1) from comment #43)
Sorry, my comment #41 was pretty much nonsense :-( - Now I read the hole bug. Yes, this is about sorting the numbers correctly. Some suggestions were already made in comment #12.
However, the approved (and non-functional) patch uses
localeCompare()
. Does that sort numbers correctly?
Yes it did then. The code seems to make sense. I also wanted to aks something, should I override the collator or can I write a new function entirely in the same file?
Comment 45•6 years ago
|
||
That's a Calendar question best directed to a Calendar peer.
Assignee | ||
Comment 46•6 years ago
|
||
Localecollator sorts the numbers as strings. So localecollator is replaced by localecompare function with numeric option set true.
Also implemented another function alphanumericCompare( ) which sorts all the numeric values before text values.
Comment 47•6 years ago
|
||
Srujana, you should ask Fallen for review. Without, this patch gets no attention.
Assignee | ||
Comment 48•6 years ago
|
||
Fallen, Can you please review my patch?
Thanks,
Srujana
Assignee | ||
Comment 49•6 years ago
|
||
Can you please review my patch? I am applying for outreachy and the deadline is fast approaching. Thank you!
Comment 50•6 years ago
|
||
Looks like the patch was already reviewed by our (inofficial?) Calendar peer Geoff (:darktrojan). So no further reviews required, this is ready to go.
I'll merge it into the code base tonight.
Updated•6 years ago
|
Comment 51•6 years ago
|
||
Fixed commit message.
Updated•6 years ago
|
Comment 52•6 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/3e648008d386
Use localeCompare() with numeric option to sort categories. r=darktrojan
Comment 55•6 years ago
|
||
Correction: 7.0.
Updated•6 years ago
|
Updated•6 years ago
|
Description
•