Search in sources :

Example 91 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class IQConfigurationController method doConfirmChangeTestAndSurvey.

/**
 * This check if there is some QTI 2.1 results for the current selected test.
 *
 * @param ureq
 * @param newEntry
 */
private void doConfirmChangeTestAndSurvey(UserRequest ureq, RepositoryEntry newEntry) {
    try {
        RepositoryEntry currentEntry = courseNode.getReferencedRepositoryEntry();
        RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
        int numOfAssessedIdentities = 0;
        if (currentEntry != null) {
            List<AssessmentTestSession> assessmentTestSessions = qti21service.getAssessmentTestSessions(courseEntry, courseNode.getIdent(), currentEntry);
            Set<Identity> assessedIdentities = new HashSet<>();
            for (AssessmentTestSession assessmentTestSession : assessmentTestSessions) {
                if (StringHelper.containsNonWhitespace(assessmentTestSession.getAnonymousIdentifier())) {
                    numOfAssessedIdentities++;
                } else if (assessmentTestSession.getIdentity() != null) {
                    assessedIdentities.add(assessmentTestSession.getIdentity());
                }
            }
            numOfAssessedIdentities += assessedIdentities.size();
        }
        if (numOfAssessedIdentities > 0) {
            confirmChangeResourceCtrl = new ConfirmChangeResourceController(ureq, getWindowControl(), course, (QTICourseNode) courseNode, newEntry, currentEntry, numOfAssessedIdentities);
            listenTo(confirmChangeResourceCtrl);
            cmc = new CloseableModalController(getWindowControl(), translate("close"), confirmChangeResourceCtrl.getInitialComponent());
            listenTo(cmc);
            cmc.activate();
        } else {
            doChangeResource(ureq, newEntry);
        }
    } catch (Exception e) {
        logError("", e);
        showError("error.resource.corrupted");
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) HashSet(java.util.HashSet) QTICourseNode(org.olat.course.nodes.QTICourseNode)

Example 92 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class IQConfigurationController method cleanUpQti21PreviewSession.

/**
 * Delete the test session created by the preview controller
 * for the QTI 2.1 tests.
 */
private void cleanUpQti21PreviewSession() {
    if (previewQTI21Ctrl != null) {
        AssessmentTestSession previewSession = previewQTI21Ctrl.getCandidateSession();
        qti21service.deleteAssessmentTestSession(previewSession);
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession)

Example 93 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class IQIdentityListCourseNodeController method doUpdateCourseNode.

private void doUpdateCourseNode(List<AssessmentTestSession> testSessionsToComplete, AssessmentTest assessmentTest, AssessmentEntryStatus status) {
    if (testSessionsToComplete == null || testSessionsToComplete.isEmpty())
        return;
    Double cutValue = QtiNodesExtractor.extractCutValue(assessmentTest);
    for (AssessmentTestSession testSession : testSessionsToComplete) {
        UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(testSession.getIdentity(), getCourseEnvironment());
        ScoreEvaluation scoreEval = ((IQTESTCourseNode) courseNode).getUserScoreEvaluation(assessedUserCourseEnv);
        BigDecimal finalScore = testSession.getFinalScore();
        Float score = finalScore == null ? null : finalScore.floatValue();
        Boolean passed = scoreEval.getPassed();
        if (testSession.getManualScore() != null && finalScore != null && cutValue != null) {
            boolean calculated = finalScore.compareTo(BigDecimal.valueOf(cutValue.doubleValue())) >= 0;
            passed = Boolean.valueOf(calculated);
        }
        AssessmentEntryStatus finalStatus = status == null ? scoreEval.getAssessmentStatus() : status;
        ScoreEvaluation manualScoreEval = new ScoreEvaluation(score, passed, finalStatus, scoreEval.getUserVisible(), scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), testSession.getKey());
        ((IQTESTCourseNode) courseNode).updateUserScoreEvaluation(manualScoreEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) BigDecimal(java.math.BigDecimal)

Example 94 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

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);
    CorrectionOverviewModel model = new CorrectionOverviewModel(courseEntry, testCourseNode.getIdent(), testEntry, resolvedAssessmentTest, manifestBuilder, lastSessionMap, Collections.singletonMap(assessedIdentity, testSessionState));
    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 95 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class QTI21IdentityListCourseNodeToolsController method doConfirmPullSession.

private void doConfirmPullSession(UserRequest ureq, AssessmentTestSession session) {
    retrieveConfirmationCtr = new QTI21RetrieveTestsController(ureq, getWindowControl(), session, (IQTESTCourseNode) courseNode);
    listenTo(retrieveConfirmationCtr);
    String title = translate("tool.pull");
    cmc = new CloseableModalController(getWindowControl(), null, retrieveConfirmationCtr.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) QTI21RetrieveTestsController(org.olat.ims.qti21.ui.QTI21RetrieveTestsController)

Aggregations

AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)107 Identity (org.olat.core.id.Identity)45 RepositoryEntry (org.olat.repository.RepositoryEntry)36 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)32 File (java.io.File)30 ArrayList (java.util.ArrayList)24 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)24 Date (java.util.Date)22 Test (org.junit.Test)20 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)20 HashMap (java.util.HashMap)17 InMemoryAssessmentTestSession (org.olat.ims.qti21.model.InMemoryAssessmentTestSession)14 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)14 AssessmentResponse (org.olat.ims.qti21.AssessmentResponse)12 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)12 IOException (java.io.IOException)10 BigDecimal (java.math.BigDecimal)10 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)10 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)10 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)10