use of uk.ac.ed.ph.jqtiplus.state.TestSessionState in project OpenOLAT by OpenOLAT.
the class AssessmentTreeComponentRenderer method renderNavigationAssessmentItem.
private void renderNavigationAssessmentItem(StringOutput sb, AssessmentTreeComponent component, TestPlanNode itemNode, Translator translator, RenderingRequest options) {
// check if currently rendered item is the active item
boolean active = false;
TestSessionController sessionCtr = component.getTestSessionController();
if (sessionCtr != null && itemNode != null) {
TestSessionState sessionState = sessionCtr.getTestSessionState();
if (sessionState != null && sessionState.getCurrentItemKey() != null) {
TestPlanNodeKey testPlanNodeKey = sessionState.getCurrentItemKey();
active = (testPlanNodeKey.getIdentifier().equals(itemNode.getIdentifier()));
}
}
sb.append("<li class='o_assessmentitem").append(" active", active).append("'>");
try {
renderAssessmentItemMark(sb, component, itemNode, translator);
renderAssessmentItemAttempts(sb, component, itemNode, translator);
renderItemStatus(sb, component, itemNode, translator, options);
renderAssessmentItemLink(sb, component, itemNode, translator);
} catch (IllegalStateException ex) {
log.error("", ex);
sb.append("<span class='o_danger'>ERROR</span>");
}
sb.append("</li>");
}
use of uk.ac.ed.ph.jqtiplus.state.TestSessionState in project openolat by klemens.
the class QTI21IdentityListCourseNodeToolsController method doOpenCorrection.
private void doOpenCorrection(UserRequest ureq) {
File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
ManifestBuilder manifestBuilder = ManifestBuilder.read(new File(unzippedDirRoot, "imsmanifest.xml"));
TestSessionState testSessionState = qtiService.loadTestSessionState(lastSession);
Map<Identity, AssessmentTestSession> lastSessionMap = new HashMap<>();
lastSessionMap.put(assessedIdentity, lastSession);
Map<Identity, TestSessionState> testSessionStates = new HashMap<>();
testSessionStates.put(assessedIdentity, testSessionState);
CorrectionOverviewModel model = new CorrectionOverviewModel(courseEntry, testCourseNode.getIdent(), testEntry, resolvedAssessmentTest, manifestBuilder, lastSessionMap, testSessionStates);
correctionCtrl = new CorrectionIdentityAssessmentItemListController(ureq, getWindowControl(), stackPanel, model, lastSession, assessedIdentity);
listenTo(correctionCtrl);
stackPanel.pushController(translate("tool.correction"), correctionCtrl);
}
use of uk.ac.ed.ph.jqtiplus.state.TestSessionState in project openolat by klemens.
the class AssessmentTestDisplayController method createNewTestSessionStateAndController.
private TestSessionController createNewTestSessionStateAndController(NotificationRecorder notificationRecorder) {
TestProcessingMap testProcessingMap = getTestProcessingMap();
/* Generate a test plan for this session */
final TestPlanner testPlanner = new TestPlanner(testProcessingMap);
if (notificationRecorder != null) {
testPlanner.addNotificationListener(notificationRecorder);
}
final TestPlan testPlan = testPlanner.generateTestPlan();
final TestSessionState testSessionState = new TestSessionState(testPlan);
final TestSessionControllerSettings testSessionControllerSettings = new TestSessionControllerSettings();
testSessionControllerSettings.setTemplateProcessingLimit(computeTemplateProcessingLimit());
testProcessingMap.reduceItemProcessingMapMap(testPlan.getTestPlanNodeList());
/* Create controller and wire up notification recorder */
final TestSessionController result = new TestSessionController(qtiService.jqtiExtensionManager(), testSessionControllerSettings, testProcessingMap, testSessionState);
if (notificationRecorder != null) {
result.addNotificationListener(notificationRecorder);
}
return result;
}
use of uk.ac.ed.ph.jqtiplus.state.TestSessionState in project openolat by klemens.
the class AssessmentTestDisplayController method doCancel.
private void doCancel(UserRequest ureq) {
VelocityContainer cancelledVC = createVelocityContainer("cancelled");
mainPanel.setContent(cancelledVC);
// only cancel unfinished test (prevent concurrent pull session / cancel to delete the data)
if (candidateSession.getFinishTime() == null) {
TestSessionState testSessionState = testSessionController.getTestSessionState();
qtiService.cancelTestSession(candidateSession, testSessionState);
}
fireEvent(ureq, Event.CANCELLED_EVENT);
candidateSession = null;
}
use of uk.ac.ed.ph.jqtiplus.state.TestSessionState in project openolat by klemens.
the class AssessmentTestDisplayController method processExitTestAfterTimeLimit.
private void processExitTestAfterTimeLimit(UserRequest ureq) {
synchronized (testSessionController) {
// make sure the ajax call and a user click don't close both the session
NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
TestSessionState testSessionState = testSessionController.getTestSessionState();
if (testSessionState.isEnded() || testSessionState.isExited())
return;
// close duration
testSessionController.touchDurations(currentRequestTimestamp);
final Date requestTimestamp = ureq.getRequestTimestamp();
testSessionController.exitTestIncomplete(requestTimestamp);
candidateSession.setTerminationTime(requestTimestamp);
// Record current result state
final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, true);
candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, requestTimestamp, getDigitalSignatureOptions(), getIdentity());
qtiWorksCtrl.updateStatusAndResults(ureq);
/* Record and log event */
final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.EXIT_DUE_TIME_LIMIT, testSessionState, notificationRecorder);
candidateAuditLogger.logCandidateEvent(candidateTestEvent);
this.lastEvent = candidateTestEvent;
}
doExitTest(ureq);
}
Aggregations