Search in sources :

Example 21 with AssessmentTest

use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project openolat by klemens.

the class IQTESTCourseNode method getQTI21TimeLimitMaxInSeconds.

/**
 * If the course element override the test configuration, the value is from
 * the course element's configuration. Else, the value is from the assessment
 * test.
 *
 * @param testEntry The test repository entry
 * @return the maximum time limit in seconds or -1 if no time limit is configured
 */
public int getQTI21TimeLimitMaxInSeconds(RepositoryEntry testEntry) {
    int timeLimit = -1;
    if (ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
        ModuleConfiguration config = getModuleConfiguration();
        boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false);
        if (!configRef && config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1) > 0) {
            timeLimit = config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1);
        } else {
            File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
            ResolvedAssessmentTest resolvedAssessmentTest = CoreSpringFactory.getImpl(QTI21Service.class).loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
            AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
            if (assessmentTest.getTimeLimits() != null && assessmentTest.getTimeLimits().getMaximum() != null) {
                timeLimit = assessmentTest.getTimeLimits().getMaximum().intValue();
            }
        }
    }
    return timeLimit;
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) ModuleConfiguration(org.olat.modules.ModuleConfiguration) QTI21Service(org.olat.ims.qti21.QTI21Service) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) File(java.io.File)

Example 22 with AssessmentTest

use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project openolat by klemens.

the class IQTESTCourseNode method hasQTI21TimeLimit.

/**
 * @param testEntry The test repository entry
 * @return true if the course node or the test has a time limit set.
 */
public boolean hasQTI21TimeLimit(RepositoryEntry testEntry) {
    boolean timeLimit = false;
    if (ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
        ModuleConfiguration config = getModuleConfiguration();
        boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false);
        if (!configRef && config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1) > 0) {
            timeLimit = true;
        } else {
            File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
            ResolvedAssessmentTest resolvedAssessmentTest = CoreSpringFactory.getImpl(QTI21Service.class).loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
            AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
            if (assessmentTest.getTimeLimits() != null && assessmentTest.getTimeLimits().getMaximum() != null) {
                timeLimit = true;
            }
        }
    }
    return timeLimit;
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) ModuleConfiguration(org.olat.modules.ModuleConfiguration) QTI21Service(org.olat.ims.qti21.QTI21Service) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) File(java.io.File)

Example 23 with AssessmentTest

use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project openolat by klemens.

the class CorrectionAssessmentItemListController method doSaveTests.

private void doSaveTests(UserRequest ureq) {
    List<AssessmentTestSession> rows = new ArrayList<>(model.getLastSessions().values());
    AssessmentTest assessmentTest = model.getResolvedAssessmentTest().getRootNodeLookup().extractIfSuccessful();
    fireEvent(ureq, new CompleteAssessmentTestSessionEvent(rows, assessmentTest, AssessmentEntryStatus.done));
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ArrayList(java.util.ArrayList) CompleteAssessmentTestSessionEvent(org.olat.modules.assessment.ui.event.CompleteAssessmentTestSessionEvent)

Example 24 with AssessmentTest

use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project openolat by klemens.

the class CorrectionIdentityAssessmentItemListController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            if ("select".equals(cmd)) {
                CorrectionIdentityAssessmentItemRow row = tableModel.getObject(se.getIndex());
                doSelect(ureq, row);
            }
        }
    } else if (saveButton == source) {
        List<AssessmentTestSession> sessions = Collections.singletonList(candidateSession);
        AssessmentTest assessmentTest = model.getResolvedAssessmentTest().getRootNodeLookup().extractIfSuccessful();
        fireEvent(ureq, new CompleteAssessmentTestSessionEvent(sessions, assessmentTest, AssessmentEntryStatus.done));
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) CorrectionIdentityAssessmentItemRow(org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) CompleteAssessmentTestSessionEvent(org.olat.modules.assessment.ui.event.CompleteAssessmentTestSessionEvent) List(java.util.List) ArrayList(java.util.ArrayList)

Example 25 with AssessmentTest

use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project openolat by klemens.

the class CorrectionIdentityListController method doSaveTests.

private void doSaveTests(UserRequest ureq) {
    Set<Integer> selections = tableEl.getMultiSelectedIndex();
    List<AssessmentTestSession> rows = new ArrayList<>(selections.size());
    for (Integer i : selections) {
        CorrectionIdentityRow row = tableModel.getObject(i.intValue());
        if (row != null) {
            rows.add(row.getCandidateSession());
        }
    }
    AssessmentTest assessmentTest = model.getResolvedAssessmentTest().getRootNodeLookup().extractIfSuccessful();
    fireEvent(ureq, new CompleteAssessmentTestSessionEvent(rows, assessmentTest, AssessmentEntryStatus.done));
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ArrayList(java.util.ArrayList) CompleteAssessmentTestSessionEvent(org.olat.modules.assessment.ui.event.CompleteAssessmentTestSessionEvent) CorrectionIdentityRow(org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityRow)

Aggregations

AssessmentTest (uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest)60 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)48 File (java.io.File)34 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)22 TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)20 FileResourceManager (org.olat.fileresource.FileResourceManager)12 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)12 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)12 IOException (java.io.IOException)10 URISyntaxException (java.net.URISyntaxException)10 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)10 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)10 ArrayList (java.util.ArrayList)8 TreeNode (org.olat.core.gui.components.tree.TreeNode)8 ManifestBuilder (org.olat.ims.qti21.model.xml.ManifestBuilder)8 FileOutputStream (java.io.FileOutputStream)6 ManifestMetadataBuilder (org.olat.ims.qti21.model.xml.ManifestMetadataBuilder)6 QtiSerializer (uk.ac.ed.ph.jqtiplus.serialization.QtiSerializer)6 AssessmentTestBuilder (org.olat.ims.qti21.model.xml.AssessmentTestBuilder)5 CompleteAssessmentTestSessionEvent (org.olat.modules.assessment.ui.event.CompleteAssessmentTestSessionEvent)5