Search in sources :

Example 31 with ResolvedAssessmentTest

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

Example 32 with ResolvedAssessmentTest

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;
}
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 33 with ResolvedAssessmentTest

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);
}
Also used : CorrectionOverviewModel(org.olat.ims.qti21.ui.assessment.CorrectionOverviewModel) ManifestBuilder(org.olat.ims.qti21.model.xml.ManifestBuilder) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) CorrectionIdentityAssessmentItemListController(org.olat.ims.qti21.ui.assessment.CorrectionIdentityAssessmentItemListController) HashMap(java.util.HashMap) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) Identity(org.olat.core.id.Identity) File(java.io.File)

Example 34 with ResolvedAssessmentTest

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

Example 35 with ResolvedAssessmentTest

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;
}
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