Skip to content

Commit

Permalink
fix: resolve issue nicolaskruchten#1359
Browse files Browse the repository at this point in the history
  • Loading branch information
Seungwoo321 committed Aug 22, 2024
1 parent 838ec2f commit eff6e82
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 9 deletions.
9 changes: 7 additions & 2 deletions dist/pivot.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/pivot.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pivot.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pivot.min.js.map

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions dist/pivot_spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/pivot_spec.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pivot_spec.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pivot_spec.min.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/pivot.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ callWithJQuery ($) ->
b1 = b.shift()
if a1 != b1
if rd.test(a1) and rd.test(b1) #both are digit chunks
return a1.replace(rz, ".0") - b1.replace(rz, ".0")
numDiff = a1.replace(rz, ".0") - b1.replace(rz, ".0")
return if numDiff != 0 then numDiff else a1.length - b1.length
else
return (if a1 > b1 then 1 else -1)
return a.length - b.length
Expand Down
12 changes: 12 additions & 0 deletions tests/pivot_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@ describe "$.pivotUtilities", ->
expect pd.getAggregator([],[]).value()
.toBe (1+3)/(2+4)

describe "with a0-a00 input", ->
aoaInput = [
{key: 'a0', ym: '2020-01'},
{key: 'a0', ym: '2020-02'},
{key: 'a00', ym: '2020-01'},
{key: 'a00', ym: '2020-02'}
]
pd = new $.pivotUtilities.PivotData aoaInput, rows: ["key", "ym"], cols: []

it "has correctly-ordered row keys", ->
expect pd.getRowKeys()
.toEqual [["a0","2020-01"],["a0","2020-02"],["a00","2020-01"],["a00","2020-02"]]

describe "with rows/cols", ->
pd = new $.pivotUtilities.PivotData fixtureData,
Expand Down

0 comments on commit eff6e82

Please sign in to comment.