use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method processSelectItem.
private void processSelectItem(UserRequest ureq, String key) {
if (checkConcurrentExit(ureq)) {
return;
}
TestPlanNodeKey nodeKey = TestPlanNodeKey.fromString(key);
Date requestTimestamp = ureq.getRequestTimestamp();
TestPlanNode selectedNode = testSessionController.selectItemNonlinear(requestTimestamp, nodeKey);
/* Record and log event */
TestPlanNodeKey selectedNodeKey = (selectedNode == null ? null : selectedNode.getKey());
NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
TestSessionState testSessionState = testSessionController.getTestSessionState();
CandidateEvent candidateEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.SELECT_MENU, null, selectedNodeKey, testSessionState, notificationRecorder);
candidateAuditLogger.logCandidateEvent(candidateEvent);
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method nextItemIfAllowed.
/**
* Try to go to the next item. It will check fi the current
* item want to show some feedback (modal or element), has some
* bad or invalid responses, state of the test session... or if
* the item is an adaptive one.
*
* @param ureq
*/
private void nextItemIfAllowed(UserRequest ureq) {
if (testSessionController.hasFollowingNonLinearItem() && testSessionController.getTestSessionState() != null && !testSessionController.getTestSessionState().isEnded() && !testSessionController.getTestSessionState().isExited()) {
try {
TestSessionState testSessionState = testSessionController.getTestSessionState();
TestPlanNodeKey itemNodeKey = testSessionState.getCurrentItemKey();
if (itemNodeKey != null) {
TestPlanNode currentItemNode = testSessionState.getTestPlan().getNode(itemNodeKey);
boolean hasFeedbacks = qtiWorksCtrl.willShowSomeAssessmentItemFeedbacks(currentItemNode);
// allow skipping
if (!hasFeedbacks) {
processNextItem(ureq);
}
}
} catch (QtiCandidateStateException e) {
// log informations
logError("", e);
ServletUtil.printOutRequestParameters(ureq.getHttpReq());
}
}
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode 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);
}
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method confirmEndTestPart.
private void confirmEndTestPart(UserRequest ureq) {
TestPlanNode nextTestPart = testSessionController.findNextEnterableTestPart();
if (nextTestPart == null) {
String title = translate("confirm.finish.test.title");
String text = translate("confirm.finish.test.text");
endTestPartDialog = activateOkCancelDialog(ureq, title, text, endTestPartDialog);
} else {
TestPart currentTestPart = testSessionController.getCurrentTestPart();
if (currentTestPart == null) {
processEndTestPart(ureq);
} else {
String title = translate("confirm.finish.testpart.title");
String text = translate("confirm.finish.testpart.text");
endTestPartDialog = activateOkCancelDialog(ureq, title, text, endTestPartDialog);
}
}
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method suspendAssessmentTest.
/**
* It suspend the current item
* @return
*/
private boolean suspendAssessmentTest(Date requestTimestamp) {
if (!deliveryOptions.isEnableSuspend() || testSessionController == null || testSessionController.getTestSessionState() == null || testSessionController.getTestSessionState().isEnded() || testSessionController.getTestSessionState().isExited() || testSessionController.getTestSessionState().isSuspended()) {
return false;
}
testSessionController.touchDurations(currentRequestTimestamp);
testSessionController.suspendTestSession(requestTimestamp);
TestSessionState testSessionState = testSessionController.getTestSessionState();
TestPlanNodeKey currentItemKey = testSessionState.getCurrentItemKey();
if (currentItemKey == null) {
return false;
}
TestPlanNode currentItemNode = testSessionState.getTestPlan().getNode(currentItemKey);
ItemProcessingContext itemProcessingContext = testSessionController.getItemProcessingContext(currentItemNode);
ItemSessionState itemSessionState = itemProcessingContext.getItemSessionState();
if (itemProcessingContext instanceof ItemSessionController && !itemSessionState.isEnded() && !itemSessionState.isExited() && itemSessionState.isOpen() && !itemSessionState.isSuspended()) {
ItemSessionController itemSessionController = (ItemSessionController) itemProcessingContext;
itemSessionController.suspendItemSession(requestTimestamp);
computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, false);
NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
final CandidateEvent candidateEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.SUSPEND, null, null, testSessionState, notificationRecorder);
candidateAuditLogger.logCandidateEvent(candidateEvent);
this.lastEvent = candidateEvent;
return true;
}
return false;
}
Aggregations