Search in sources :

Example 21 with QtiCandidateStateException

use of uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException in project openolat by klemens.

the class AssessmentTestDisplayController method processItemSolution.

private void processItemSolution(UserRequest ureq, String key) {
    TestPlanNodeKey itemKey = TestPlanNodeKey.fromString(key);
    NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    // assertSessionNotTerminated(candidateSession);
    try {
        if (!testSessionController.mayAccessItemSolution(itemKey)) {
            candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_SOLUTION_TEST_ITEM, null);
            logError("CANNOT_SOLUTION_TEST_ITEM", null);
            return;
        }
    } catch (final QtiCandidateStateException e) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_SOLUTION_TEST_ITEM, e);
        logError("CANNOT_SOLUTION_TEST_ITEM", e);
        return;
    } catch (final RuntimeException e) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_SOLUTION_TEST_ITEM, e);
        logError("Exploded", e);
        // handleExplosion(e, candidateSession);
        return;
    }
    /* Record current result state */
    computeAndRecordTestAssessmentResult(ureq.getRequestTimestamp(), testSessionState, false);
    /* Record and log event */
    CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.SOLUTION_ITEM, null, itemKey, testSessionState, notificationRecorder);
    this.lastEvent = candidateTestEvent;
    candidateAuditLogger.logCandidateEvent(candidateTestEvent);
}
Also used : QtiCandidateStateException(uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Aggregations

QtiCandidateStateException (uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException)21 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)19 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)17 Date (java.util.Date)15 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)13 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)11 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)8 AssessmentResult (uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult)7 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)7 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)6 CandidateTestEventType (org.olat.ims.qti21.model.audit.CandidateTestEventType)5 HashMap (java.util.HashMap)4 AssessmentResponse (org.olat.ims.qti21.AssessmentResponse)4 AssessmentResponseData (org.olat.ims.qti21.model.audit.AssessmentResponseData)4 CandidateItemEventType (org.olat.ims.qti21.model.audit.CandidateItemEventType)4 StringInput (org.olat.ims.qti21.ui.ResponseInput.StringInput)4 FileResponseData (uk.ac.ed.ph.jqtiplus.types.FileResponseData)4 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)4 ResponseData (uk.ac.ed.ph.jqtiplus.types.ResponseData)4 StringResponseData (uk.ac.ed.ph.jqtiplus.types.StringResponseData)4