Search in sources :

Example 16 with ResolvedAssessmentTest

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;
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) FileResourceManager(org.olat.fileresource.FileResourceManager) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) File(java.io.File)

Example 17 with ResolvedAssessmentTest

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;
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) FileResourceManager(org.olat.fileresource.FileResourceManager) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) File(java.io.File)

Example 18 with ResolvedAssessmentTest

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);
    });
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) URI(java.net.URI) File(java.io.File)

Example 19 with ResolvedAssessmentTest

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);
}
Also used : FileResourceManager(org.olat.fileresource.FileResourceManager) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) File(java.io.File)

Example 20 with 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;
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Aggregations

ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)40 File (java.io.File)32 AssessmentTest (uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest)24 FileResourceManager (org.olat.fileresource.FileResourceManager)16 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)10 URI (java.net.URI)8 ArrayList (java.util.ArrayList)8 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)8 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)8 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)8 HashMap (java.util.HashMap)7 ManifestBuilder (org.olat.ims.qti21.model.xml.ManifestBuilder)6 ManifestMetadataBuilder (org.olat.ims.qti21.model.xml.ManifestMetadataBuilder)6 AssessmentObjectXmlLoader (uk.ac.ed.ph.jqtiplus.reading.AssessmentObjectXmlLoader)6 QtiXmlReader (uk.ac.ed.ph.jqtiplus.reading.QtiXmlReader)6 ResourceLocator (uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator)6 URISyntaxException (java.net.URISyntaxException)4 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)4 Identity (org.olat.core.id.Identity)4 PathResourceLocator (org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator)4