Search in sources :

Example 61 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project openolat by klemens.

the class QTI21AssessmentRunController method doShowResults.

private void doShowResults(UserRequest ureq) {
    removeAsListenerAndDispose(resultCtrl);
    AssessmentTestSession session = null;
    if (courseNode instanceof SelfAssessableCourseNode) {
        RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
        session = qtiService.getLastAssessmentTestSessions(courseEntry, courseNode.getIdent(), testEntry, getIdentity());
    } else {
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        AssessmentEntry assessmentEntry = am.getAssessmentEntry(courseNode, getIdentity());
        if (assessmentEntry.getAssessmentId() != null) {
            session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
        } else {
            RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
            session = qtiService.getLastAssessmentTestSessions(courseEntry, courseNode.getIdent(), testEntry, getIdentity());
        }
    }
    if (session == null) {
        mainVC.contextPut("showResults", Boolean.FALSE);
    } else {
        FileResourceManager frm = FileResourceManager.getInstance();
        File fUnzippedDirRoot = frm.unzipFileResource(session.getTestEntry().getOlatResource());
        URI assessmentObjectUri = qtiService.createAssessmentTestUri(fUnzippedDirRoot);
        File submissionDir = qtiService.getAssessmentResultFile(session);
        String mapperUri = registerCacheableMapper(ureq, "QTI21CNResults::" + session.getTestEntry().getKey(), new ResourcesMapper(assessmentObjectUri, submissionDir));
        resultCtrl = new AssessmentResultController(ureq, getWindowControl(), getIdentity(), true, session, fUnzippedDirRoot, mapperUri, null, getDeliveryOptions().getAssessmentResultsOptions(), false, false, true);
        listenTo(resultCtrl);
        mainVC.put("resultReport", resultCtrl.getInitialComponent());
        mainVC.contextPut("showResults", Boolean.TRUE);
    }
    saveOpenPanel(ureq, "results", Boolean.TRUE);
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) FileResourceManager(org.olat.fileresource.FileResourceManager) AssessmentManager(org.olat.course.assessment.AssessmentManager) ResourcesMapper(org.olat.ims.qti21.ui.ResourcesMapper) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentResultController(org.olat.ims.qti21.ui.AssessmentResultController) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File) URI(java.net.URI) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode)

Example 62 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project openolat by klemens.

the class QTI21AssessmentRunController method doDownloadSignature.

private void doDownloadSignature(UserRequest ureq) {
    MediaResource resource = null;
    if (courseNode instanceof IQTESTCourseNode) {
        IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
        AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
        AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
        File signature = qtiService.getAssessmentResultSignature(session);
        if (signature.exists()) {
            resource = new DownloadeableMediaResource(signature);
        }
    }
    if (resource == null) {
        resource = new NotFoundMediaResource();
    }
    ureq.getDispatchResult().setResultingMediaResource(resource);
}
Also used : NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) DownloadeableMediaResource(org.olat.fileresource.DownloadeableMediaResource) MediaResource(org.olat.core.gui.media.MediaResource) DownloadeableMediaResource(org.olat.fileresource.DownloadeableMediaResource) NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Example 63 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project openolat by klemens.

the class IQIdentityListCourseNodeController method getExtraTimes.

/**
 * @return A map identity key to extra time
 */
private Map<Long, ExtraTimeInfos> getExtraTimes() {
    Map<Long, ExtraTimeInfos> identityToExtraTime = new HashMap<>();
    List<AssessmentTestSession> sessions = qtiService.getAssessmentTestSessions(getCourseRepositoryEntry(), courseNode.getIdent(), getReferencedRepositoryEntry());
    // sort by identity, then by creation date
    Collections.sort(sessions, new AssessmentTestSessionComparator());
    Long currentIdentityKey = null;
    for (AssessmentTestSession session : sessions) {
        Long identityKey = session.getIdentity().getKey();
        if (currentIdentityKey == null || !currentIdentityKey.equals(identityKey)) {
            if (session.getFinishTime() == null && session.getExtraTime() != null) {
                Integer extraTimeInSeconds = session.getExtraTime();
                Date start = session.getCreationDate();
                ExtraTimeInfos infos = new ExtraTimeInfos(extraTimeInSeconds, start);
                identityToExtraTime.put(identityKey, infos);
            }
            currentIdentityKey = identityKey;
        }
    }
    return identityToExtraTime;
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) HashMap(java.util.HashMap) Date(java.util.Date)

Example 64 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project openolat by klemens.

the class ConfirmExtraTimeController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("fullnames", sessionToFullnames());
        if (assessmentModes.size() > 0) {
            currentAssessmentModeMessage(layoutCont);
        }
    }
    int extraTime = 0;
    for (AssessmentTestSession testSession : testSessions) {
        if (testSession.getExtraTime() != null && extraTime < testSession.getExtraTime().intValue()) {
            extraTime = testSession.getExtraTime().intValue();
        }
    }
    String maxExtraTime = extraTime == 0 ? "" : Integer.toString(extraTime / 60);
    extraTimeInMinEl = uifactory.addTextElement("extra.time.minutes", null, 5, maxExtraTime, formLayout);
    extraTimeInMinEl.setDisplaySize(5);
    extraTimeInMinEl.setDomReplacementWrapperRequired(false);
    uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
    uifactory.addFormSubmitButton("extra.time", formLayout);
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 65 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project openolat by klemens.

the class ConfirmExtraTimeController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    int extraTime = getExtraTime();
    for (AssessmentTestSession testSession : testSessions) {
        qtiService.extraTimeAssessmentTestSession(testSession, extraTime, getIdentity());
    }
    fireEvent(ureq, Event.CHANGED_EVENT);
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession)

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