use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem in project openolat by klemens.
the class AssessmentTestComposerController method recalculateMaxScoreAssessmentTest.
private void recalculateMaxScoreAssessmentTest(Map<AssessmentItemRef, AssessmentItem> flyingObjects) {
DoubleAdder atomicMaxScore = new DoubleAdder();
AssessmentTest assessmentTest = (AssessmentTest) menuTree.getTreeModel().getRootNode().getUserObject();
AssessmentTestHelper.visit(assessmentTest, new AssessmentTestVisitor() {
@Override
public void visit(TestPart testPart) {
/* */
}
@Override
public void visit(SectionPart sectionPart) {
if (sectionPart instanceof AssessmentItemRef) {
AssessmentItemRef itemRef = (AssessmentItemRef) sectionPart;
ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
checkAndFixAbsolutePath(itemRef);
AssessmentItem assessmentItem = null;
if (resolvedAssessmentItem != null) {
assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
}
if (assessmentItem == null && flyingObjects != null && flyingObjects.containsKey(itemRef)) {
assessmentItem = flyingObjects.get(itemRef);
}
if (assessmentItem != null) {
Double maxScore = QtiNodesExtractor.extractMaxScore(assessmentItem);
if (maxScore != null) {
atomicMaxScore.add(maxScore.doubleValue());
}
}
}
}
});
double sumMaxScore = atomicMaxScore.sum();
if (sumMaxScore > 0.0d) {
assessmentTestBuilder.setMaxScore(sumMaxScore);
} else {
assessmentTestBuilder.setMaxScore(null);
}
}
use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem in project openolat by klemens.
the class FeedbackResultComponentRenderer method render.
@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
FeedbackResultComponent cmp = (FeedbackResultComponent) source;
ResolvedAssessmentItem resolvedAssessmentItem = cmp.getResolvedAssessmentItem();
ItemSessionState itemSessionState = cmp.getItemSessionState();
AssessmentRenderer assessmentRenderer = new AssessmentRenderer(renderer);
AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
for (ModalFeedback modalFeedback : assessmentItem.getModalFeedbacks()) {
Identifier outcomeIdentifier = modalFeedback.getOutcomeIdentifier();
if (QTI21Constants.CORRECT_SOLUTION_IDENTIFIER.equals(outcomeIdentifier)) {
sb.append("<div class='modalFeedback'>");
renderAssessmentItemCorrectSolutionModalFeedback(assessmentRenderer, sb, modalFeedback, cmp, resolvedAssessmentItem, itemSessionState, ubu, translator);
sb.append("</div>");
}
}
}
use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem in project openolat by klemens.
the class CorrectionOverviewModel method isManualCorrection.
public boolean isManualCorrection(AssessmentItemRef itemRef) {
String identifier = itemRef.getIdentifier().toString();
return manualCorrections.computeIfAbsent(identifier, id -> {
ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
AssessmentItem item = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
List<Interaction> interactions = item.getItemBody().findInteractions();
for (Interaction interaction : interactions) {
if (interaction instanceof UploadInteraction || interaction instanceof DrawingInteraction || interaction instanceof ExtendedTextInteraction) {
return true;
}
}
return false;
});
}
use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem in project OpenOLAT by OpenOLAT.
the class AssessmentItemCheckerTest method loadAssessmentItem.
private AssessmentItem loadAssessmentItem(URL itemUrl) throws URISyntaxException {
QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager());
ResourceLocator fileResourceLocator = new PathResourceLocator(Paths.get(itemUrl.toURI()));
AssessmentObjectXmlLoader assessmentObjectXmlLoader = new AssessmentObjectXmlLoader(qtiXmlReader, fileResourceLocator);
ResolvedAssessmentItem item = assessmentObjectXmlLoader.loadAndResolveAssessmentItem(itemUrl.toURI());
return item.getItemLookup().getRootNodeHolder().getRootNode();
}
use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem in project OpenOLAT by OpenOLAT.
the class HottextAssessmentItemBuilderTest method loadAssessmentItem.
private AssessmentItem loadAssessmentItem(URL itemUrl) throws URISyntaxException {
QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager());
ResourceLocator fileResourceLocator = new PathResourceLocator(Paths.get(itemUrl.toURI()));
AssessmentObjectXmlLoader assessmentObjectXmlLoader = new AssessmentObjectXmlLoader(qtiXmlReader, fileResourceLocator);
ResolvedAssessmentItem item = assessmentObjectXmlLoader.loadAndResolveAssessmentItem(itemUrl.toURI());
return item.getItemLookup().getRootNodeHolder().getRootNode();
}
Aggregations