Search in sources :

Example 11 with TestPart

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;
}
Also used : ItemSessionControl(uk.ac.ed.ph.jqtiplus.node.test.ItemSessionControl) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Example 12 with TestPart

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);
        }
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Example 13 with TestPart

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;
}
Also used : OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) AssessmentResult(uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult) Date(java.util.Date) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 14 with TestPart

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>");
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Example 15 with TestPart

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;
}
Also used : ItemSessionControl(uk.ac.ed.ph.jqtiplus.node.test.ItemSessionControl) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Aggregations

TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)50 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)28 AssessmentTest (uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest)20 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)16 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)12 TreeNode (org.olat.core.gui.components.tree.TreeNode)12 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)12 File (java.io.File)8 ItemSessionControl (uk.ac.ed.ph.jqtiplus.node.test.ItemSessionControl)8 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)8 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)6 URI (java.net.URI)4 Date (java.util.Date)4 NameValuePair (org.olat.core.gui.components.form.flexible.impl.NameValuePair)4 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)4 RubricBlock (uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock)4 Ordering (uk.ac.ed.ph.jqtiplus.node.test.Ordering)4 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)4 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)3 FileOutputStream (java.io.FileOutputStream)2