Skip to content

Commit

Permalink
fixes #341
Browse files Browse the repository at this point in the history
  • Loading branch information
henriyli committed Nov 2, 2015
1 parent 406139e commit c46f406
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions resource/js/hierarchy.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ function buildParentTree(uri, parentData, schemes) {
var loopIndex = 0, // for adding the last concept as a root if no better candidates have been found.
currentNode,
rootArray = [],
schemeOpened = false,
rootNode;

if (schemes.length > 1) {
Expand All @@ -153,9 +154,11 @@ function buildParentTree(uri, parentData, schemes) {
schemes[i].children = [];
}
schemes[i].children.push(currentNode);
// the hierarchy response contains the parent information before the topConcepts so it's a safe bet to open the first node
if (loopIndex === 0)
// the hierarchy response contains the parent info before the topConcepts so it's a safe to open the first one without broaders
if (schemeOpened === false && !currentNode.broader) {
schemes[i].state = currentNode.state;
schemeOpened = true;
}
}
}
}
Expand Down

0 comments on commit c46f406

Please sign in to comment.