use of org.olat.ims.qti.editor.beecom.objects.Item in project openolat by klemens.
the class QTI12AssessmentStatisticsController method getMaxScoreSetting.
private Float getMaxScoreSetting(QTICourseNode testNode, List<Item> items) {
Float maxScoreSetting;
if (QTIType.test.equals(type)) {
Object maxScoreObj = testNode.getModuleConfiguration().get(IQEditController.CONFIG_KEY_MAXSCORE);
if (maxScoreObj instanceof Float) {
maxScoreSetting = (Float) maxScoreObj;
} else {
// try to calculate max
float max = 0;
for (Item item : items) {
if (item.getQuestion() != null) {
max += item.getQuestion().getMaxValue();
}
}
maxScoreSetting = max > 0 ? max : null;
}
} else {
maxScoreSetting = null;
}
return maxScoreSetting;
}
use of org.olat.ims.qti.editor.beecom.objects.Item in project openolat by klemens.
the class QTI12To21Converter method isConvertible.
public static boolean isConvertible(OLATResource resource) {
if (TestFileResource.TYPE_NAME.equals(resource.getResourceableTypeName())) {
if (OnyxModule.isOnyxTest(resource)) {
return true;
}
QTIDocument doc = TestFileResource.getQTIDocument(resource);
if (doc == null) {
return false;
}
boolean alien = false;
@SuppressWarnings("unchecked") List<Item> items = doc.getAssessment().getItems();
for (int i = 0; i < items.size(); i++) {
Item item = items.get(i);
alien |= item.isAlient();
}
return !alien;
}
return false;
}
Aggregations