use of org.olat.ims.qti21.model.audit.CandidateEvent 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.CandidateEvent in project openolat by klemens.
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 klemens.
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 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.CandidateEvent 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);
}
}
Aggregations