use of org.olat.ims.qti21.model.audit.CandidateTestEventType in project openolat by klemens.
the class AssessmentTestDisplayController method processEndTestPart.
// public CandidateSession endCurrentTestPart(final CandidateSessionContext candidateSessionContext)
private void processEndTestPart(UserRequest ureq) {
/* Update state */
final Date requestTimestamp = ureq.getRequestTimestamp();
testSessionController.endCurrentTestPart(requestTimestamp);
TestSessionState testSessionState = testSessionController.getTestSessionState();
TestPlanNode nextTestPart = testSessionController.findNextEnterableTestPart();
// Record current result state
final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, nextTestPart == null);
if (nextTestPart == null) {
candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, requestTimestamp, getDigitalSignatureOptions(), getIdentity());
if (!qtiWorksCtrl.willShowSomeAssessmentTestFeedbacks()) {
// need feedback, no more parts, quickly exit
try {
// end current test part
testSessionController.enterNextAvailableTestPart(requestTimestamp);
} catch (final QtiCandidateStateException e) {
candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_ADVANCE_TEST_PART, e);
logError("CANNOT_ADVANCE_TEST_PART", e);
return;
} catch (final RuntimeException e) {
candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_ADVANCE_TEST_PART, e);
logError("RuntimeException", e);
// handleExplosion(e, candidateSession);
return;
}
// exit the test
NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
CandidateTestEventType eventType = CandidateTestEventType.EXIT_TEST;
testSessionController.exitTest(requestTimestamp);
candidateSession.setTerminationTime(requestTimestamp);
candidateSession = qtiService.updateAssessmentTestSession(candidateSession);
/* Record and log event */
final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, eventType, testSessionState, notificationRecorder);
candidateAuditLogger.logCandidateEvent(candidateTestEvent);
this.lastEvent = candidateTestEvent;
qtiWorksCtrl.updateStatusAndResults(ureq);
doExitTest(ureq);
}
} else if (!qtiWorksCtrl.willShowSomeTestPartFeedbacks()) {
// no feedback, go to the next part
processAdvanceTestPart(ureq);
}
}
use of org.olat.ims.qti21.model.audit.CandidateTestEventType in project openolat by klemens.
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;
}
use of org.olat.ims.qti21.model.audit.CandidateTestEventType in project openolat by klemens.
the class AssessmentTestComponentRenderer method renderTestEvent.
private void renderTestEvent(TestSessionController testSessionController, AssessmentRenderer renderer, StringOutput target, AssessmentTestComponent component, URLBuilder ubu, Translator translator) {
CandidateSessionContext candidateSessionContext = component.getCandidateSessionContext();
CandidateEvent candidateEvent = candidateSessionContext.getLastEvent();
CandidateTestEventType testEventType = candidateEvent.getTestEventType();
/* If session has terminated, render appropriate state and exit */
final TestSessionState testSessionState = testSessionController.getTestSessionState();
if (candidateSessionContext.isTerminated() || testSessionState.isExited()) {
renderTerminated(target, translator);
} else if (testEventType == CandidateTestEventType.REVIEW_ITEM) {
renderer.setReviewMode(true);
TestPlanNodeKey itemKey = extractTargetItemKey(candidateEvent);
RenderingRequest options = RenderingRequest.getItemReview();
renderTestItem(renderer, target, component, itemKey, ubu, translator, options);
} else if (testEventType == CandidateTestEventType.SOLUTION_ITEM) {
renderer.setSolutionMode(true);
TestPlanNodeKey itemKey = extractTargetItemKey(candidateEvent);
RenderingRequest options = RenderingRequest.getItemSolution();
renderTestItem(renderer, target, component, itemKey, ubu, translator, options);
} else {
/* Render current state */
final TestPlanNodeKey currentTestPartKey = testSessionState.getCurrentTestPartKey();
if (testSessionState.isEnded()) {
/* At end of test, so show overall test feedback */
renderTestPartFeedback(renderer, target, component, ubu, translator);
} else if (currentTestPartKey != null) {
final TestPartSessionState currentTestPartSessionState = testSessionState.getTestPartSessionStates().get(currentTestPartKey);
final TestPlanNodeKey currentItemKey = testSessionState.getCurrentItemKey();
if (currentItemKey != null) {
/* An item is selected, so render it in appropriate state */
RenderingRequest options = RenderingRequest.getItem(testSessionController);
renderTestItem(renderer, target, component, currentItemKey, ubu, translator, options);
} else {
/* No item selected */
if (currentTestPartSessionState.isEnded()) {
/* testPart has ended, so must be showing testPart feedback */
renderTestPartFeedback(renderer, target, component, ubu, translator);
} else {
/* testPart not ended, so we must be showing the navigation menu in nonlinear mode */
renderNavigation(renderer, target, component, ubu, translator);
}
}
} else {
/* No current testPart == start of multipart test */
renderTestEntry(target, component, translator);
}
}
}
use of org.olat.ims.qti21.model.audit.CandidateTestEventType in project openolat by klemens.
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);
}
}
use of org.olat.ims.qti21.model.audit.CandidateTestEventType in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method processEndTestPart.
// public CandidateSession endCurrentTestPart(final CandidateSessionContext candidateSessionContext)
private void processEndTestPart(UserRequest ureq) {
/* Update state */
final Date requestTimestamp = ureq.getRequestTimestamp();
testSessionController.endCurrentTestPart(requestTimestamp);
TestSessionState testSessionState = testSessionController.getTestSessionState();
TestPlanNode nextTestPart = testSessionController.findNextEnterableTestPart();
// Record current result state
final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, nextTestPart == null);
if (nextTestPart == null) {
candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, requestTimestamp, getDigitalSignatureOptions(), getIdentity());
if (!qtiWorksCtrl.willShowSomeAssessmentTestFeedbacks()) {
// need feedback, no more parts, quickly exit
try {
// end current test part
testSessionController.enterNextAvailableTestPart(requestTimestamp);
} catch (final QtiCandidateStateException e) {
candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_ADVANCE_TEST_PART, e);
logError("CANNOT_ADVANCE_TEST_PART", e);
return;
} catch (final RuntimeException e) {
candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_ADVANCE_TEST_PART, e);
logError("RuntimeException", e);
// handleExplosion(e, candidateSession);
return;
}
// exit the test
NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
CandidateTestEventType eventType = CandidateTestEventType.EXIT_TEST;
testSessionController.exitTest(requestTimestamp);
candidateSession.setTerminationTime(requestTimestamp);
candidateSession = qtiService.updateAssessmentTestSession(candidateSession);
/* Record and log event */
final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, eventType, testSessionState, notificationRecorder);
candidateAuditLogger.logCandidateEvent(candidateTestEvent);
this.lastEvent = candidateTestEvent;
qtiWorksCtrl.updateStatusAndResults(ureq);
doExitTest(ureq);
}
} else if (!qtiWorksCtrl.willShowSomeTestPartFeedbacks()) {
// no feedback, go to the next part
processAdvanceTestPart(ureq);
}
}
Aggregations