use of org.olat.ims.qti21.model.audit.CandidateEvent in project OpenOLAT by OpenOLAT.
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.CandidateEvent in project OpenOLAT by OpenOLAT.
the class AssessmentItemComponentRenderer method render.
@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
AssessmentItemComponent cmp = (AssessmentItemComponent) source;
sb.append("<div class='qtiworks o_assessmentitem'>");
ItemSessionController itemSessionController = cmp.getItemSessionController();
CandidateSessionContext candidateSessionContext = cmp.getCandidateSessionContext();
/* Create appropriate options that link back to this controller */
final AssessmentTestSession candidateSession = candidateSessionContext.getCandidateSession();
if (candidateSession != null && candidateSession.isExploded()) {
renderExploded(sb, translator);
} else if (candidateSessionContext.isTerminated()) {
renderTerminated(sb, translator);
} else {
/* Look up most recent event */
// assertSessionEntered(candidateSession);
final CandidateEvent latestEvent = candidateSessionContext.getLastEvent();
/* Load the ItemSessionState */
// candidateDataService.loadItemSessionState(latestEvent);
final ItemSessionState itemSessionState = cmp.getItemSessionController().getItemSessionState();
/* Touch the session's duration state if appropriate */
if (itemSessionState.isEntered() && !itemSessionState.isEnded() && !itemSessionState.isSuspended()) {
final Date timestamp = candidateSessionContext.getCurrentRequestTimestamp();
itemSessionController.touchDuration(timestamp);
}
/* Render event */
AssessmentRenderer renderHints = new AssessmentRenderer(renderer);
renderItemEvent(renderHints, sb, cmp, latestEvent, itemSessionState, ubu, translator);
}
sb.append("</div>");
}
use of org.olat.ims.qti21.model.audit.CandidateEvent in project OpenOLAT by OpenOLAT.
the class AssessmentItemComponentRenderer method renderItemEvent.
private void renderItemEvent(AssessmentRenderer renderer, StringOutput sb, AssessmentItemComponent component, CandidateEvent candidateEvent, ItemSessionState itemSessionState, URLBuilder ubu, Translator translator) {
final CandidateItemEventType itemEventType = candidateEvent.getItemEventType();
/* If session has terminated, render appropriate state and exit */
if (itemSessionState.isExited()) {
renderTerminated(sb, translator);
return;
}
if (itemEventType == CandidateItemEventType.SOLUTION) {
renderer.setSolutionMode(true);
}
/* Now set candidate action permissions depending on state of session */
if (itemEventType == CandidateItemEventType.SOLUTION || itemSessionState.isEnded()) {
/* Item session is ended (closed) */
renderer.setEndAllowed(false);
renderer.setHardResetAllowed(false);
renderer.setSoftResetAllowed(false);
renderer.setSolutionAllowed(true);
renderer.setCandidateCommentAllowed(false);
} else if (itemSessionState.isOpen()) {
/* Item session is open (interacting) */
renderer.setEndAllowed(true);
renderer.setHardResetAllowed(false);
renderer.setSoftResetAllowed(false);
renderer.setSolutionAllowed(true);
renderer.setCandidateCommentAllowed(false);
} else {
throw new OLATRuntimeException("Item has not been entered yet. We do not currently support rendering of this state.", null);
}
// final List<CandidateEventNotification> notifications = candidateEvent.getNotifications();
try {
renderTestItemBody(renderer, sb, component, itemSessionState, ubu, translator);
} catch (final RuntimeException e) {
/* Rendering is complex and may trigger an unexpected Exception (due to a bug in the XSLT).
* In this case, the best we can do for the candidate is to 'explode' the session.
* See bug #49.
*/
log.error("", e);
renderExploded(sb, translator);
}
}
use of org.olat.ims.qti21.model.audit.CandidateEvent in project OpenOLAT by OpenOLAT.
the class QTI21ServiceImpl method getItemSessionStateFile.
private File getItemSessionStateFile(CandidateEvent candidateEvent) {
AssessmentTestSession candidateSession = candidateEvent.getCandidateSession();
File myStore = testSessionDao.getSessionStorage(candidateSession);
return new File(myStore, "itemSessionState.xml");
}
use of org.olat.ims.qti21.model.audit.CandidateEvent in project OpenOLAT by OpenOLAT.
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;
}
Aggregations