use of uk.ac.ed.ph.jqtiplus.node.test.TestPart in project OpenOLAT by OpenOLAT.
the class AssessmentTestFactory method createTestPart.
public static TestPart createTestPart(AssessmentTest assessmentTest) {
TestPart part = new TestPart(assessmentTest);
part.setIdentifier(IdentifierGenerator.newAsIdentifier("tp"));
part.setNavigationMode(NavigationMode.NONLINEAR);
part.setSubmissionMode(SubmissionMode.INDIVIDUAL);
assessmentTest.getTestParts().add(part);
// test par item session control
ItemSessionControl itemSessionControl = new ItemSessionControl(part);
itemSessionControl.setAllowComment(Boolean.TRUE);
itemSessionControl.setAllowReview(Boolean.FALSE);
// default is true
itemSessionControl.setAllowSkipping(Boolean.TRUE);
itemSessionControl.setShowFeedback(Boolean.FALSE);
itemSessionControl.setShowSolution(Boolean.FALSE);
itemSessionControl.setMaxAttempts(0);
part.setItemSessionControl(itemSessionControl);
return part;
}
use of uk.ac.ed.ph.jqtiplus.node.test.TestPart in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method confirmAdvanceTestPart.
/**
* In the case of a multi-part test, the entry to the first part
* must not be confirmed.
* @param ureq
*/
private void confirmAdvanceTestPart(UserRequest ureq) {
TestPlanNode nextTestPart = testSessionController.findNextEnterableTestPart();
if (nextTestPart == null) {
String title = translate("confirm.close.test.title");
String text = translate("confirm.close.test.text");
advanceTestPartDialog = activateOkCancelDialog(ureq, title, text, advanceTestPartDialog);
} else {
TestPart currentTestPart = testSessionController.getCurrentTestPart();
if (currentTestPart == null) {
processAdvanceTestPart(ureq);
} else {
String title = translate("confirm.advance.testpart.title");
String text = translate("confirm.advance.testpart.text");
advanceTestPartDialog = activateOkCancelDialog(ureq, title, text, advanceTestPartDialog);
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.test.TestPart in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method enterSession.
// private CandidateSession enterCandidateSession(final CandidateSession candidateSession)
private TestSessionController enterSession(UserRequest ureq) {
/* Set up listener to record any notifications */
final NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
/* Create fresh JQTI+ state & controller for it */
testSessionController = createNewTestSessionStateAndController(notificationRecorder);
if (testSessionController == null) {
return null;
}
/* Initialise test state and enter test */
final TestSessionState testSessionState = testSessionController.getTestSessionState();
final Date timestamp = ureq.getRequestTimestamp();
try {
testSessionController.initialize(timestamp);
final int testPartCount = testSessionController.enterTest(timestamp);
if (testPartCount == 1) {
/* If there is only testPart, then enter this (if possible).
* (Note that this may cause the test to exit immediately if there is a failed
* preCondition on this part.)
*/
testSessionController.enterNextAvailableTestPart(timestamp);
} else {
/* Don't enter first testPart yet - we shall tell candidate that
* there are multiple parts and let them enter manually.
*/
}
} catch (final RuntimeException e) {
logError("", e);
return null;
}
/* Record and log event */
final CandidateEvent candidateEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.ENTER_TEST, testSessionState, notificationRecorder);
candidateAuditLogger.logCandidateEvent(candidateEvent);
this.lastEvent = candidateEvent;
boolean ended = testSessionState.isEnded();
/* Record current result state */
final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(timestamp, testSessionState, ended);
/* Handle immediate end of test session */
if (ended) {
candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, timestamp, getDigitalSignatureOptions(), getIdentity());
} else {
TestPart currentTestPart = testSessionController.getCurrentTestPart();
if (currentTestPart != null && currentTestPart.getNavigationMode() == NavigationMode.NONLINEAR) {
// go to the first assessment item
if (testSessionController.hasFollowingNonLinearItem()) {
testSessionController.selectFollowingItemNonLinear(currentRequestTimestamp);
}
}
}
return testSessionController;
}
use of uk.ac.ed.ph.jqtiplus.node.test.TestPart in project OpenOLAT by OpenOLAT.
the class AssessmentTestComponentRenderer method renderTestPartFeedback.
private void renderTestPartFeedback(AssessmentRenderer renderer, StringOutput sb, AssessmentTestComponent component, URLBuilder ubu, Translator translator) {
sb.append("<div class='qtiworks o_assessmenttest testFeedback'>").append("<h1>");
if (component.hasMultipleTestParts()) {
sb.append(translator.translate("test.part.complete"));
} else {
sb.append(translator.translate("test.complete"));
}
sb.append("</h1>");
// Show 'atEnd' testPart feedback
TestPlanNode currentTestPartNode = component.getCurrentTestPartNode();
TestPart currentTestPart = component.getTestPart(currentTestPartNode.getIdentifier());
renderTestFeebacks(renderer, sb, currentTestPart.getTestFeedbacks(), component, TestFeedbackAccess.AT_END, ubu, translator);
// Show 'atEnd' test feedback f there's only 1 testPart
// if(!component.hasMultipleTestParts()) {
renderTestFeebacks(renderer, sb, component.getAssessmentTest().getTestFeedbacks(), component, TestFeedbackAccess.AT_END, ubu, translator);
// }
// test part review
component.getTestSessionController().getTestSessionState().getTestPlan().getTestPartNodes().forEach((testPartNode) -> renderReview(renderer, sb, component, testPartNode, ubu, translator));
// controls
/*
sb.append("<div class='o_button_group'>");
String title = component.hasMultipleTestParts()
? translator.translate("assessment.test.end.testPart") : translator.translate("assessment.test.end.test");
renderControl(sb, component, title, "o_sel_end_testpart",
new NameValuePair("cid", Event.advanceTestPart.name()));
sb.append("</div>");
*/
sb.append("</div>");
}
use of uk.ac.ed.ph.jqtiplus.node.test.TestPart in project openolat by klemens.
the class AssessmentTestFactory method createTestPart.
public static TestPart createTestPart(AssessmentTest assessmentTest) {
TestPart part = new TestPart(assessmentTest);
part.setIdentifier(IdentifierGenerator.newAsIdentifier("tp"));
part.setNavigationMode(NavigationMode.NONLINEAR);
part.setSubmissionMode(SubmissionMode.INDIVIDUAL);
assessmentTest.getTestParts().add(part);
// test par item session control
ItemSessionControl itemSessionControl = new ItemSessionControl(part);
itemSessionControl.setAllowComment(Boolean.TRUE);
itemSessionControl.setAllowReview(Boolean.FALSE);
// default is true
itemSessionControl.setAllowSkipping(Boolean.TRUE);
itemSessionControl.setShowFeedback(Boolean.FALSE);
itemSessionControl.setShowSolution(Boolean.FALSE);
itemSessionControl.setMaxAttempts(0);
part.setItemSessionControl(itemSessionControl);
return part;
}
Aggregations