Search in sources :

Example 1 with CandidateEvent

use of org.olat.ims.qti21.model.audit.CandidateEvent in project OpenOLAT by OpenOLAT.

the class AssessmentTreeComponentRenderer method renderTestEvent.

private void renderTestEvent(TestSessionController testSessionController, AssessmentRenderer renderer, StringOutput target, AssessmentTreeComponent component, URLBuilder ubu, Translator translator, RenderingRequest options) {
    CandidateSessionContext candidateSessionContext = component.getCandidateSessionContext();
    CandidateEvent candidateEvent = candidateSessionContext.getLastEvent();
    CandidateTestEventType testEventType = candidateEvent.getTestEventType();
    final TestSessionState testSessionState = testSessionController.getTestSessionState();
    if (!candidateSessionContext.isTerminated() && !testSessionState.isExited()) {
        if (testEventType == CandidateTestEventType.REVIEW_ITEM) {
            renderer.setReviewMode(true);
        } else if (testEventType == CandidateTestEventType.SOLUTION_ITEM) {
            renderer.setSolutionMode(true);
        }
        renderNavigation(renderer, target, component, ubu, translator, options);
    }
}
Also used : CandidateSessionContext(org.olat.ims.qti21.ui.CandidateSessionContext) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) CandidateTestEventType(org.olat.ims.qti21.model.audit.CandidateTestEventType) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 2 with CandidateEvent

use of org.olat.ims.qti21.model.audit.CandidateEvent in project OpenOLAT by OpenOLAT.

the class AssessmentItemComponentRenderer method render.

@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    AssessmentItemComponent cmp = (AssessmentItemComponent) source;
    sb.append("<div class='qtiworks o_assessmentitem'>");
    ItemSessionController itemSessionController = cmp.getItemSessionController();
    CandidateSessionContext candidateSessionContext = cmp.getCandidateSessionContext();
    /* Create appropriate options that link back to this controller */
    final AssessmentTestSession candidateSession = candidateSessionContext.getCandidateSession();
    if (candidateSession != null && candidateSession.isExploded()) {
        renderExploded(sb, translator);
    } else if (candidateSessionContext.isTerminated()) {
        renderTerminated(sb, translator);
    } else {
        /* Look up most recent event */
        // assertSessionEntered(candidateSession);
        final CandidateEvent latestEvent = candidateSessionContext.getLastEvent();
        /* Load the ItemSessionState */
        // candidateDataService.loadItemSessionState(latestEvent);
        final ItemSessionState itemSessionState = cmp.getItemSessionController().getItemSessionState();
        /* Touch the session's duration state if appropriate */
        if (itemSessionState.isEntered() && !itemSessionState.isEnded() && !itemSessionState.isSuspended()) {
            final Date timestamp = candidateSessionContext.getCurrentRequestTimestamp();
            itemSessionController.touchDuration(timestamp);
        }
        /* Render event */
        AssessmentRenderer renderHints = new AssessmentRenderer(renderer);
        renderItemEvent(renderHints, sb, cmp, latestEvent, itemSessionState, ubu, translator);
    }
    sb.append("</div>");
}
Also used : CandidateSessionContext(org.olat.ims.qti21.ui.CandidateSessionContext) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ItemSessionController(uk.ac.ed.ph.jqtiplus.running.ItemSessionController) Date(java.util.Date) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 3 with CandidateEvent

use of org.olat.ims.qti21.model.audit.CandidateEvent in project OpenOLAT by OpenOLAT.

the class AssessmentItemComponentRenderer method renderItemEvent.

private void renderItemEvent(AssessmentRenderer renderer, StringOutput sb, AssessmentItemComponent component, CandidateEvent candidateEvent, ItemSessionState itemSessionState, URLBuilder ubu, Translator translator) {
    final CandidateItemEventType itemEventType = candidateEvent.getItemEventType();
    /* If session has terminated, render appropriate state and exit */
    if (itemSessionState.isExited()) {
        renderTerminated(sb, translator);
        return;
    }
    if (itemEventType == CandidateItemEventType.SOLUTION) {
        renderer.setSolutionMode(true);
    }
    /* Now set candidate action permissions depending on state of session */
    if (itemEventType == CandidateItemEventType.SOLUTION || itemSessionState.isEnded()) {
        /* Item session is ended (closed) */
        renderer.setEndAllowed(false);
        renderer.setHardResetAllowed(false);
        renderer.setSoftResetAllowed(false);
        renderer.setSolutionAllowed(true);
        renderer.setCandidateCommentAllowed(false);
    } else if (itemSessionState.isOpen()) {
        /* Item session is open (interacting) */
        renderer.setEndAllowed(true);
        renderer.setHardResetAllowed(false);
        renderer.setSoftResetAllowed(false);
        renderer.setSolutionAllowed(true);
        renderer.setCandidateCommentAllowed(false);
    } else {
        throw new OLATRuntimeException("Item has not been entered yet. We do not currently support rendering of this state.", null);
    }
    // final List<CandidateEventNotification> notifications = candidateEvent.getNotifications();
    try {
        renderTestItemBody(renderer, sb, component, itemSessionState, ubu, translator);
    } catch (final RuntimeException e) {
        /* Rendering is complex and may trigger an unexpected Exception (due to a bug in the XSLT).
             * In this case, the best we can do for the candidate is to 'explode' the session.
             * See bug #49.
             */
        log.error("", e);
        renderExploded(sb, translator);
    }
}
Also used : CandidateItemEventType(org.olat.ims.qti21.model.audit.CandidateItemEventType) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException)

Example 4 with CandidateEvent

use of org.olat.ims.qti21.model.audit.CandidateEvent in project OpenOLAT by OpenOLAT.

the class QTI21ServiceImpl method getItemSessionStateFile.

private File getItemSessionStateFile(CandidateEvent candidateEvent) {
    AssessmentTestSession candidateSession = candidateEvent.getCandidateSession();
    File myStore = testSessionDao.getSessionStorage(candidateSession);
    return new File(myStore, "itemSessionState.xml");
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) InMemoryAssessmentTestSession(org.olat.ims.qti21.model.InMemoryAssessmentTestSession) File(java.io.File)

Example 5 with CandidateEvent

use of org.olat.ims.qti21.model.audit.CandidateEvent in project OpenOLAT by OpenOLAT.

the class QTI21ServiceImpl method recordCandidateTestEvent.

@Override
public CandidateEvent recordCandidateTestEvent(AssessmentTestSession candidateSession, RepositoryEntryRef testEntry, RepositoryEntryRef entry, CandidateTestEventType textEventType, CandidateItemEventType itemEventType, TestPlanNodeKey itemKey, TestSessionState testSessionState, NotificationRecorder notificationRecorder) {
    CandidateEvent event = new CandidateEvent(candidateSession, testEntry, entry);
    event.setTestEventType(textEventType);
    event.setItemEventType(itemEventType);
    if (itemKey != null) {
        event.setTestItemKey(itemKey.toString());
    }
    storeTestSessionState(event, testSessionState);
    return event;
}
Also used : CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Aggregations

CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)54 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)36 Date (java.util.Date)34 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)32 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)22 QtiCandidateStateException (uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException)21 AssessmentResult (uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult)20 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)20 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)16 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)14 CandidateTestEventType (org.olat.ims.qti21.model.audit.CandidateTestEventType)12 AssessmentResponse (org.olat.ims.qti21.AssessmentResponse)10 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)10 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)10 HashMap (java.util.HashMap)8 CandidateItemEventType (org.olat.ims.qti21.model.audit.CandidateItemEventType)8 CandidateSessionContext (org.olat.ims.qti21.ui.CandidateSessionContext)8 StringInput (org.olat.ims.qti21.ui.ResponseInput.StringInput)8 FileResponseData (uk.ac.ed.ph.jqtiplus.types.FileResponseData)8 ResponseData (uk.ac.ed.ph.jqtiplus.types.ResponseData)8