Commit d6a397be authored by Paul-Christian Volkmer's avatar Paul-Christian Volkmer
Browse files

Merge branch 'master'

parents 960bbb8b 5cb0d889
......@@ -20,7 +20,7 @@ import de.thm.arsnova.connector.model.IliasCategoryNode;
import de.thm.arsnova.connector.model.IliasFeedback;
import de.thm.arsnova.connector.model.IliasQuestion;
@Filter(Type.QUESTION_POOL)
@Filter(Type.TEST)
public class IliasConnectorDaoImpl implements UniRepDao {
@Autowired
......
......@@ -29,9 +29,9 @@ public class UniRepServiceImpl implements UniRepService {
}
List<IliasCategoryNode> result = uniRepDao.getTreeObjects(refId);
while(removeBranchesWithoutQuestionPools(result));
result = this.removeNotMarkedNodes(result, false);
while(removeBranchesWithoutQuestionPools(result));
if (result.size() == 1) {
return result.get(0);
......@@ -95,12 +95,12 @@ public class UniRepServiceImpl implements UniRepService {
}
return hasRemovedNodes;
}
private List<IliasCategoryNode> removeNotMarkedNodes(List<IliasCategoryNode> nodes, boolean isParentMarked) {
Map<String, String> metaTagRefIds = uniRepDao.getReferenceIdsWithMetaDataFlag("UniRepApp");
Map<String, String> categoryMetaTagRefIds = uniRepDao.getReferenceIdsWithMetaDataFlag("UniRepApp");
Map<String, String> courseMetaTagRefIds = uniRepDao.getReferenceIdsWithMetaDataFlag("UniRepCourse");
if (nodes == null) {
return null;
}
......@@ -109,26 +109,38 @@ public class UniRepServiceImpl implements UniRepService {
while (it.hasNext()) {
IliasCategoryNode node = it.next();
if (metaTagRefIds.containsKey(String.valueOf(node.getId()))) {
if("no".equals(metaTagRefIds.get(String.valueOf(node.getId())))) {
it.remove();
if("crs".equals(node.getType())) {
if("yes".equals(courseMetaTagRefIds.get(String.valueOf(node.getId())))) {
continue;
}
else if("yes".equals(metaTagRefIds.get(String.valueOf(node.getId())))) {
removeNotMarkedNodes(node.getChildren(), true);
else {
it.remove();
continue;
}
}
else {
if(isParentMarked) {
removeNotMarkedNodes(node.getChildren(), true);
if (categoryMetaTagRefIds.containsKey(String.valueOf(node.getId()))) {
if("no".equals(categoryMetaTagRefIds.get(String.valueOf(node.getId())))) {
it.remove();
continue;
}
else if("yes".equals(categoryMetaTagRefIds.get(String.valueOf(node.getId())))) {
removeNotMarkedNodes(node.getChildren(), true);
}
}
else {
removeNotMarkedNodes(node.getChildren(), false);
if(node.getChildren() == null || node.getChildren().size() == 0) {
it.remove();
if(isParentMarked) {
removeNotMarkedNodes(node.getChildren(), true);
}
else {
removeNotMarkedNodes(node.getChildren(), false);
if(node.getChildren() == null || node.getChildren().size() == 0) {
it.remove();
}
}
}
}
......
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