use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest in project openolat by klemens.
the class QTI21AssessmentRunController method getAssessmentTestMaxTimeLimit.
/**
* @return The maximum time limit in seconds.
*/
private Long getAssessmentTestMaxTimeLimit() {
if (overrideOptions != null && overrideOptions.getAssessmentTestMaxTimeLimit() != null) {
Long timeLimits = overrideOptions.getAssessmentTestMaxTimeLimit();
return timeLimits.longValue() > 0 ? timeLimits.longValue() : null;
}
FileResourceManager frm = FileResourceManager.getInstance();
File fUnzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(fUnzippedDirRoot, false, false);
AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
if (assessmentTest != null && assessmentTest.getTimeLimits() != null && assessmentTest.getTimeLimits().getMaximum() != null) {
return assessmentTest.getTimeLimits().getMaximum().longValue();
}
return null;
}
use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
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 OpenOLAT.
the class QTI21ServiceImpl method needManualCorrection.
@Override
public boolean needManualCorrection(RepositoryEntry testEntry) {
FileResourceManager frm = FileResourceManager.getInstance();
File fUnzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = loadAndResolveAssessmentTest(fUnzippedDirRoot, false, false);
return AssessmentTestHelper.needManualCorrection(resolvedAssessmentTest);
}
use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest in project OpenOLAT by OpenOLAT.
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