Commit fda91531 authored by Andreas Gärtner's avatar Andreas Gärtner
Browse files

Added leaf attribute to branches without children.

parent 6c1114aa
......@@ -13,6 +13,7 @@ public class IliasCategoryNode {
private int parent;
private String title;
private String type;
private String leaf;
private int questionCount;
private List<IliasCategoryNode> children;
......@@ -60,6 +61,13 @@ public class IliasCategoryNode {
public void setQuestionCount(int questionCount) {
this.questionCount = questionCount;
}
public String getLeaf() {
return leaf;
}
public void setLeaf(String leaf) {
this.leaf = leaf;
}
public List<IliasCategoryNode> getChildren() {
return children;
......
......@@ -85,11 +85,15 @@ public class UniRepServiceImpl implements UniRepService {
if (node == null) {
continue;
}
if (node.getQuestionCount() == 0 && (node.getChildren() == null || node.getChildren().size() == 0)) {
it.remove();
hasRemovedNodes = true;
continue;
if(node.getChildren() == null || node.getChildren().size() == 0) {
if(node.getQuestionCount() == 0) {
it.remove();
hasRemovedNodes = true;
continue;
} else {
node.setLeaf("true");
}
}
if (removeBranchesWithoutQuestionPools(node.getChildren())) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment