Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sorting of concepts in hierarchy that broke in PR 1133 #1140

Merged
merged 1 commit into from
Mar 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions resource/js/hierarchy.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ function getTreeConfiguration() {
var aNode = this.get_node(a);
var bNode = this.get_node(b);

// sort on notation if requested
// sort on notation if requested, and notations exist
if (window.showNotation) {
var aNotation = aNode.original.notation;
var bNotation = bNode.original.notation;
Expand All @@ -524,15 +524,15 @@ function getTreeConfiguration() {
else return -1;
}
else if (bNotation) return 1;
} else {
// no sorting on notation requested
// make sure the tree nodes with class 'domain' are sorted before the others
// aDomain/bDomain will be "0" if a/b has a domain class, else "1"
var aDomain = (aNode.original.a_attr['class'] == 'domain') ? "0" : "1";
var bDomain = (bNode.original.a_attr['class'] == 'domain') ? "0" : "1";
return naturalCompare(aDomain + " " + aNode.text.toLowerCase(),
bDomain + " " + bNode.text.toLowerCase());
}
// NOTE: if no notations found, fall back on label comparison below
}
// no sorting on notation requested, or notations don't exist
// make sure the tree nodes with class 'domain' are sorted before the others
// aDomain/bDomain will be "0" if a/b has a domain class, else "1"
var aDomain = (aNode.original.a_attr['class'] == 'domain') ? "0" : "1";
var bDomain = (bNode.original.a_attr['class'] == 'domain') ? "0" : "1";
return naturalCompare(aDomain + " " + aNode.text.toLowerCase(),
bDomain + " " + bNode.text.toLowerCase());
}
});
}
Expand Down