use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest in project openolat by klemens.
the class QTI21EditForm method update.
protected void update(RepositoryEntry testEntry) {
Double minValue = null;
Double maxValue = null;
Double cutValue = null;
FileResourceManager frm = FileResourceManager.getInstance();
File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
if (assessmentTest != null) {
AssessmentTestBuilder testBuilder = new AssessmentTestBuilder(assessmentTest);
maxValue = testBuilder.getMaxScore();
cutValue = testBuilder.getCutValue();
if (maxValue != null && "OpenOLAT".equals(assessmentTest.getToolName())) {
minValue = 0d;
}
}
// Put values to module configuration
minScoreEl.setValue(minValue == null ? "" : AssessmentHelper.getRoundedScore(minValue));
minScoreEl.setVisible(minValue != null);
maxScoreEl.setValue(maxValue == null ? "" : AssessmentHelper.getRoundedScore(maxValue));
maxScoreEl.setVisible(maxValue != null);
cutValueEl.setValue(cutValue == null ? "" : AssessmentHelper.getRoundedScore(cutValue));
cutValueEl.setVisible(cutValue != null);
update();
}
use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest in project openolat by klemens.
the class QTI21EditLayoutForm method getMaxTimeLimit.
/**
* @return The time limit of the assessment test in seconds or -1 if not configured
*/
private long getMaxTimeLimit() {
FileResourceManager frm = FileResourceManager.getInstance();
File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
long timeLimit = -1;
if (assessmentTest != null && assessmentTest.getTimeLimits() != null && assessmentTest.getTimeLimits().getMaximum() != null) {
timeLimit = assessmentTest.getTimeLimits().getMaximum().longValue();
}
return timeLimit;
}
use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest in project openolat by klemens.
the class QTI21IdentityListCourseNodeToolsController method doOpenCorrection.
private void doOpenCorrection(UserRequest ureq) {
File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
ManifestBuilder manifestBuilder = ManifestBuilder.read(new File(unzippedDirRoot, "imsmanifest.xml"));
TestSessionState testSessionState = qtiService.loadTestSessionState(lastSession);
Map<Identity, AssessmentTestSession> lastSessionMap = new HashMap<>();
lastSessionMap.put(assessedIdentity, lastSession);
Map<Identity, TestSessionState> testSessionStates = new HashMap<>();
testSessionStates.put(assessedIdentity, testSessionState);
CorrectionOverviewModel model = new CorrectionOverviewModel(courseEntry, testCourseNode.getIdent(), testEntry, resolvedAssessmentTest, manifestBuilder, lastSessionMap, testSessionStates);
correctionCtrl = new CorrectionIdentityAssessmentItemListController(ureq, getWindowControl(), stackPanel, model, lastSession, assessedIdentity);
listenTo(correctionCtrl);
stackPanel.pushController(translate("tool.correction"), correctionCtrl);
}
use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest in project openolat by klemens.
the class QTI21ServiceImpl method loadAndResolveAssessmentTest.
@Override
public ResolvedAssessmentTest loadAndResolveAssessmentTest(File resourceDirectory, boolean replace, boolean debugInfo) {
URI assessmentObjectSystemId = createAssessmentTestUri(resourceDirectory);
if (assessmentObjectSystemId == null) {
return null;
}
File resourceFile = new File(assessmentObjectSystemId);
if (replace) {
ResolvedAssessmentTest resolvedAssessmentTest = internalLoadAndResolveAssessmentTest(resourceDirectory, assessmentObjectSystemId);
assessmentTestsCache.replace(resourceFile, resolvedAssessmentTest);
return resolvedAssessmentTest;
}
return assessmentTestsCache.computeIfAbsent(resourceFile, file -> {
return internalLoadAndResolveAssessmentTest(resourceDirectory, assessmentObjectSystemId);
});
}
use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest in project openolat by klemens.
the class AssessmentTestHelper method needManualCorrection.
public static boolean needManualCorrection(ResolvedAssessmentTest resolvedAssessmentTest) {
AssessmentTest test = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
boolean needManualCorrection = false;
List<TestPart> parts = test.getChildAbstractParts();
for (TestPart part : parts) {
List<AssessmentSection> sections = part.getAssessmentSections();
for (AssessmentSection section : sections) {
if (needManualCorrection(section, resolvedAssessmentTest)) {
needManualCorrection = true;
break;
}
}
}
return needManualCorrection;
}
Aggregations