Closed
Bug 1439900
Opened 6 years ago
Closed 6 years ago
Move unifinder related functions to calUnifinderUtils.jsm
Categories
(Calendar :: Internal Components, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
6.2
People
(Reporter: Fallen, Assigned: Fallen)
References
Details
Attachments
(1 file, 1 obsolete file)
30.94 KB,
patch
|
MakeMyDay
:
review+
Fallen
:
approval-calendar-beta+
|
Details | Diff | Splinter Review |
This is a fully manual change aimed at moving the unifinder related methods out of calUtils. I've consolidated some of the methods to make the file more compact, since these methods will probably not be used externally anyway.
Assignee | ||
Comment 1•6 years ago
|
||
Attachment #8952701 -
Flags: review?(makemyday)
Assignee | ||
Comment 2•6 years ago
|
||
Successful try run: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=6bf2037ffe4e067c007a0e4fe0dd6eb94c986c84&selectedJob=164056900 (note that try may look like it doesn't have all bugs, but there was a previous failed try run, so the newest one isn't showing all changesets. See https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=ae663d89c9caf8d2f0917f5c83168d8540100ea1&selectedJob=163954434 for the previous run)
Comment 3•6 years ago
|
||
Comment on attachment 8952701 [details] [diff] [review] Fix - v1 Review of attachment 8952701 [details] [diff] [review]: ----------------------------------------------------------------- r+ with the comments below considered. On top of this, I would appreciate if you can add unit tests for the functions in calendarUnifinderUtils, at least for the two you reworked. ::: calendar/base/modules/calUnifinderUtils.jsm @@ +9,5 @@ > + > +this.EXPORTED_SYMBOLS = ["calunifinder"]; /* exported calunifinder */ > + > +var calunifinder = { > + getItemSortKey: function(aItem, aKey, aStartTime) { Please add doc blocks for the four functions in calUnifinderUtils.jsm @@ +79,5 @@ > + > + sortEntryComparer: function(sortType) { > + const compNameMap = { > + number: function(a, b, modifier) { > + return compNameMap.general(Number(a), Number(b)); please add the modifier when calling general. @@ +105,5 @@ > + if (a.length == 0 || b.length == 0) { > + // sort empty values to end (so when users first sort by a > + // column, they can see and find the desired values in that > + // column without scrolling past all the empty values). > + return -(a.length - b.length); This doesn't neccessarily provide -1, 0 or 1. Just use return compNameMap.number(a.length, b.length, modifier); ::: calendar/base/modules/calUtilsCompat.jsm @@ +87,5 @@ > + sortEntryComparer: "sortEntryComparer", > + getItemSortKey: "getItemSortKey", > + getSortTypeForSortKey: "getSortTypeForSortKey", > + // compareNative*, compareNumber, sortEntry, sortEntryItem, > + // sortEntryKey is no longer available. There is a new ...are no longer available
Attachment #8952701 -
Flags: review?(makemyday) → review+
Assignee | ||
Comment 4•6 years ago
|
||
(In reply to [:MakeMyDay] from comment #3) > Please add doc blocks for the four functions in calUnifinderUtils.jsm Done, also added this file to eslint. > @@ +105,5 @@ > > + if (a.length == 0 || b.length == 0) { > > + // sort empty values to end (so when users first sort by a > > + // column, they can see and find the desired values in that > > + // column without scrolling past all the empty values). > > + return -(a.length - b.length); > > This doesn't neccessarily provide -1, 0 or 1. Just use > > return compNameMap.number(a.length, b.length, modifier); I believe it doesn't have to, this is also the scoring that was used before. .sort() will happily accept a value -3 and consider it the same as -1. I did add the missing modifier though. Looking into unit tests next.
Assignee | ||
Comment 5•6 years ago
|
||
This was a useful exercise, I found two regressions that were avoided. I've also removed another of the functions to condense the code, and moved the comptor map into global scope so it isn't re-created on each run. There are also unit tests now.
Attachment #8952701 -
Attachment is obsolete: true
Attachment #8962259 -
Flags: review?(makemyday)
Comment 6•6 years ago
|
||
Comment on attachment 8962259 [details] [diff] [review] bug-1439900-move-unifinder-related-functions-to-calunifinderutilsjsm-v2.diff Review of attachment 8962259 [details] [diff] [review]: ----------------------------------------------------------------- Thanks, looks good.
Attachment #8962259 -
Flags: review?(makemyday) → review+
Assignee | ||
Updated•6 years ago
|
Keywords: checkin-needed
Pushed by mozilla@jorgk.com: https://hg.mozilla.org/comm-central/rev/e4188d5b03a3 Move unifinder related functions to calUnifinderUtils.jsm. r=MakeMyDay
Updated•6 years ago
|
Target Milestone: --- → 6.3
Assignee | ||
Updated•6 years ago
|
Attachment #8962259 -
Flags: approval-calendar-beta+
Assignee | ||
Comment 8•6 years ago
|
||
https://hg.mozilla.org/releases/comm-beta/7b17cda8efa8 Bug 1439900 - Move unifinder related functions to calUnifinderUtils.jsm. r=MakeMyDay
Target Milestone: 6.3 → 6.2
Comment 9•6 years ago
|
||
https://hg.mozilla.org/releases/comm-beta/rev/7b17cda8efa8 Bug 1439900 - Move unifinder related functions to calUnifinderUtils.jsm. r=MakeMyDay
You need to log in
before you can comment on or make changes to this bug.
Description
•