Search in sources :

Example 21 with Event

use of org.olat.ims.qti21.ui.QTIWorksAssessmentTestEvent.Event in project OpenOLAT by OpenOLAT.

the class CorrectionIdentityListController 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)) {
                CorrectionIdentityRow row = tableModel.getObject(se.getIndex());
                doSelect(ureq, row);
            }
        }
    } else if (saveTestsButton == source) {
        doConfirmSaveTests(ureq);
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) CorrectionIdentityRow(org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityRow)

Example 22 with Event

use of org.olat.ims.qti21.ui.QTIWorksAssessmentTestEvent.Event in project OpenOLAT by OpenOLAT.

the class QTI21EditorController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == editorCtrl) {
        if (event instanceof AssessmentItemEvent) {
            AssessmentItemEvent aie = (AssessmentItemEvent) event;
            AssessmentItem assessmentItem = aie.getAssessmentItem();
            qtiService.persistAssessmentObject(resourceFile, assessmentItem);
            updateQuestionItem(ureq, assessmentItem);
        }
    }
}
Also used : ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) AssessmentItemEvent(org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)

Example 23 with Event

use of org.olat.ims.qti21.ui.QTIWorksAssessmentTestEvent.Event in project openolat by klemens.

the class AssessmentItemDisplayController method handleTemporaryResponses.

public void handleTemporaryResponses(UserRequest ureq, Map<Identifier, ResponseInput> stringResponseMap) {
    /* Retrieve current JQTI state and set up JQTI controller */
    NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    ItemSessionState itemSessionState = itemSessionController.getItemSessionState();
    /* Make sure an attempt is allowed */
    if (itemSessionState.isEnded()) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.RESPONSES_NOT_EXPECTED, null);
        logError("RESPONSES_NOT_EXPECTED", null);
        return;
    }
    /* Build response map in required format for JQTI+.
		 * NB: The following doesn't test for duplicate keys in the two maps. I'm not sure
		 * it's worth the effort.
		 */
    final Map<Identifier, ResponseData> responseDataMap = new HashMap<>();
    final Map<Identifier, AssessmentResponse> assessmentResponseDataMap = new HashMap<>();
    if (stringResponseMap != null) {
        for (final Entry<Identifier, ResponseInput> stringResponseEntry : stringResponseMap.entrySet()) {
            Identifier identifier = stringResponseEntry.getKey();
            ResponseInput responseData = stringResponseEntry.getValue();
            if (responseData instanceof StringInput) {
                responseDataMap.put(identifier, new StringResponseData(((StringInput) responseData).getResponseData()));
            }
        }
    }
    final Date timestamp = ureq.getRequestTimestamp();
    /* Attempt to bind responses */
    boolean allResponsesValid = false;
    boolean allResponsesBound = false;
    try {
        itemSessionController.bindResponses(timestamp, responseDataMap);
    } catch (final QtiCandidateStateException e) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.RESPONSES_NOT_EXPECTED, null);
        logError("RESPONSES_NOT_EXPECTED", e);
        return;
    } catch (final RuntimeException e) {
        logError("", e);
        return;
    }
    /* Record resulting attempt and event */
    final CandidateItemEventType eventType = allResponsesBound ? (allResponsesValid ? CandidateItemEventType.ATTEMPT_VALID : CandidateItemEventType.RESPONSE_INVALID) : CandidateItemEventType.RESPONSE_BAD;
    final CandidateEvent candidateEvent = qtiService.recordCandidateItemEvent(candidateSession, null, entry, eventType, itemSessionState, notificationRecorder);
    candidateAuditLogger.logCandidateEvent(candidateEvent, assessmentResponseDataMap);
    lastEvent = candidateEvent;
}
Also used : QtiCandidateStateException(uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException) CandidateItemEventType(org.olat.ims.qti21.model.audit.CandidateItemEventType) HashMap(java.util.HashMap) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) FileResponseData(uk.ac.ed.ph.jqtiplus.types.FileResponseData) StringResponseData(uk.ac.ed.ph.jqtiplus.types.StringResponseData) AssessmentResponseData(org.olat.ims.qti21.model.audit.AssessmentResponseData) ResponseData(uk.ac.ed.ph.jqtiplus.types.ResponseData) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) AssessmentResponse(org.olat.ims.qti21.AssessmentResponse) Date(java.util.Date) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent) StringInput(org.olat.ims.qti21.ui.ResponseInput.StringInput) Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) StringResponseData(uk.ac.ed.ph.jqtiplus.types.StringResponseData)

Example 24 with Event

use of org.olat.ims.qti21.ui.QTIWorksAssessmentTestEvent.Event in project openolat by klemens.

the class AssessmentItemDisplayController method enterSession.

private ItemSessionController enterSession(UserRequest ureq) /*, final UserTestSession candidateSession */
{
    /* Set up listener to record any notifications */
    final NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    /* Create fresh JQTI+ state Object and try to create controller */
    itemSessionController = createNewItemSessionStateAndController(notificationRecorder);
    if (itemSessionController == null) {
        logError("Cannot create item session controller for:" + itemFileRef, null);
        return null;
    }
    /* Try to Initialise JQTI+ state */
    final ItemSessionState itemSessionState = itemSessionController.getItemSessionState();
    try {
        final Date timestamp = ureq.getRequestTimestamp();
        itemSessionController.initialize(timestamp);
        itemSessionController.performTemplateProcessing(timestamp);
        itemSessionController.enterItem(timestamp);
    } catch (final RuntimeException e) {
        logError("", e);
        return null;
    }
    /* Record and log entry event */
    final CandidateEvent candidateEvent = qtiService.recordCandidateItemEvent(candidateSession, null, entry, CandidateItemEventType.ENTER, itemSessionState, notificationRecorder);
    candidateAuditLogger.logCandidateEvent(candidateEvent);
    lastEvent = candidateEvent;
    /* Record current result state */
    final AssessmentResult assessmentResult = computeAndRecordItemAssessmentResult(ureq);
    /* Handle immediate end of session */
    if (itemSessionState.isEnded()) {
        qtiService.finishItemSession(candidateSession, assessmentResult, ureq.getRequestTimestamp());
    }
    return itemSessionController;
}
Also used : ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) AssessmentResult(uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult) Date(java.util.Date) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 25 with Event

use of org.olat.ims.qti21.ui.QTIWorksAssessmentTestEvent.Event in project openolat by klemens.

the class AssessmentItemDisplayController method exitSession.

public void exitSession(UserRequest ureq) {
    ItemSessionState itemSessionState = itemSessionController.getItemSessionState();
    /* Are we terminating a session that hasn't already been ended? If so end the session and record final result. */
    final Date currentTimestamp = ureq.getRequestTimestamp();
    if (!itemSessionState.isEnded()) {
        try {
            itemSessionController.endItem(currentTimestamp);
        } catch (final RuntimeException e) {
            logError("", e);
            // handleExplosion(e, candidateSession);
            return;
        }
        final AssessmentResult assessmentResult = computeAndRecordItemAssessmentResult(ureq);
        qtiService.finishItemSession(candidateSession, assessmentResult, currentTimestamp);
    }
    /* Update session entity */
    candidateSession.setTerminationTime(currentTimestamp);
    candidateSession = qtiService.updateAssessmentTestSession(candidateSession);
    /* Record and log event */
    final CandidateEvent candidateEvent = qtiService.recordCandidateItemEvent(candidateSession, null, entry, CandidateItemEventType.EXIT, itemSessionState);
    lastEvent = candidateEvent;
    candidateAuditLogger.logCandidateEvent(candidateEvent);
}
Also used : ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) AssessmentResult(uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult) Date(java.util.Date) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Aggregations

CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)46 Date (java.util.Date)36 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)32 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)32 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)22 AssessmentResult (uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult)20 QtiCandidateStateException (uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException)19 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)18 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)16 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)14 HashMap (java.util.HashMap)12 List (java.util.List)10 RetrieveAssessmentTestSessionEvent (org.olat.ims.qti21.ui.event.RetrieveAssessmentTestSessionEvent)10 OLATResourceable (org.olat.core.id.OLATResourceable)8 AssessmentResponse (org.olat.ims.qti21.AssessmentResponse)8 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)8 StringInput (org.olat.ims.qti21.ui.ResponseInput.StringInput)8 FileResponseData (uk.ac.ed.ph.jqtiplus.types.FileResponseData)8 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)8 ResponseData (uk.ac.ed.ph.jqtiplus.types.ResponseData)8