Skip to content

Commit

Permalink
gh-31 Fix incorect sort direction logic in computeUniqueValues
Browse files Browse the repository at this point in the history
  • Loading branch information
at055612 committed Feb 20, 2019
1 parent 9cc8deb commit 44d2da2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions war/vis/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1216,10 +1216,11 @@ if(!visualisations) {
// If there isn't then the order will be insertion order into the
// sets.
if (obj.hasOwnProperty('sortDirections')) {
if (obj.sortDirections[fieldIndex] === commonConstants.sortDescending) {
var sortDirection = obj.sortDirections[fieldIndex];
if (sortDirection === commonConstants.sortDescending) {
obj.unique[fieldIndex].reverse();
obj.visibleUnique[fieldIndex].reverse();
} else {
} else if (sortDirection === commonConstants.sortAscending){
obj.unique[fieldIndex].sort();
obj.visibleUnique[fieldIndex].sort();
}
Expand Down Expand Up @@ -1278,10 +1279,11 @@ if(!visualisations) {
// If there isn't then the order will be insertion order into the
// sets.
if (data.hasOwnProperty('keySortDirection')) {
if (data.keySortDirection === commonConstants.sortDescending) {
var sortDirection = data.keySortDirection;
if (sortDirection === commonConstants.sortDescending) {
data.uniqueKeys.reverse();
data.visibleUniqueKeys.reverse();
} else {
} else if (sortDirection === commonConstants.sortDescending) {
data.uniqueKeys.sort();
data.visibleUniqueKeys.sort();
}
Expand Down

0 comments on commit 44d2da2

Please sign in to comment.