Search in sources :

Example 1 with ItemSessionState

use of uk.ac.ed.ph.jqtiplus.state.ItemSessionState in project OpenOLAT by OpenOLAT.

the class AssessmentTestComponent method isItemFeedbackAllowed.

// <xsl:if test="$itemFeedbackAllowed and $sessionStatus='final'">
// <xsl:variable name="itemFeedbackAllowed" as="xs:boolean"
// select="if ($reviewMode)
// then (/qti:assessentItem/@adaptive='true' or $showFeedback)
// else (not($solutionMode))"/>
public boolean isItemFeedbackAllowed(TestPlanNode itemNode, AssessmentItem assessmentItem, RenderingRequest options) {
    ItemSessionState itemSessionState = getItemSessionState(itemNode.getKey());
    boolean itemFeedbackAllowed = false;
    if (itemSessionState.getSessionStatus() == SessionStatus.FINAL) {
        if (options.isReviewMode()) {
            if (assessmentItem.getAdaptive() || itemNode.getEffectiveItemSessionControl().isShowFeedback()) {
                itemFeedbackAllowed = true;
            }
        } else if (!options.isSolutionMode()) {
            itemFeedbackAllowed = true;
        }
    }
    return itemFeedbackAllowed;
}
Also used : ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState)

Example 2 with ItemSessionState

use of uk.ac.ed.ph.jqtiplus.state.ItemSessionState in project OpenOLAT by OpenOLAT.

the class QTI21ItemBodyController method createNewItemSessionStateAndController.

private ItemSessionController createNewItemSessionStateAndController() {
    /* Resolve the underlying JQTI+ object */
    final ItemProcessingMap itemProcessingMap = new ItemProcessingInitializer(resolvedAssessmentItem, true).initialize();
    /* Create fresh state for session */
    final ItemSessionState itemSessionState = new ItemSessionState();
    final ItemSessionControllerSettings itemSessionControllerSettings = new ItemSessionControllerSettings();
    itemSessionControllerSettings.setTemplateProcessingLimit(25);
    itemSessionControllerSettings.setMaxAttempts(10);
    /* Create controller and wire up notification recorder */
    final ItemSessionController sessionController = new ItemSessionController(qtiService.jqtiExtensionManager(), itemSessionControllerSettings, itemProcessingMap, itemSessionState);
    sessionController.addNotificationListener(new NotificationRecorder(NotificationLevel.ERROR));
    sessionController.initialize(new Date());
    return sessionController;
}
Also used : ItemSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.ItemSessionControllerSettings) ItemProcessingMap(uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) ItemProcessingInitializer(uk.ac.ed.ph.jqtiplus.running.ItemProcessingInitializer) ItemSessionController(uk.ac.ed.ph.jqtiplus.running.ItemSessionController) Date(java.util.Date)

Example 3 with ItemSessionState

use of uk.ac.ed.ph.jqtiplus.state.ItemSessionState in project OpenOLAT by OpenOLAT.

the class AssessmentTreeComponentRenderer method renderItemStatus.

private void renderItemStatus(StringOutput sb, AssessmentTreeComponent component, TestPlanNode itemNode, Translator translator, RenderingRequest options) {
    ItemProcessingContext itemProcessingContext = component.getItemSessionState(itemNode);
    ItemSessionState itemSessionState = itemProcessingContext.getItemSessionState();
    renderItemStatus(sb, itemSessionState, options, translator);
}
Also used : ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ItemProcessingContext(uk.ac.ed.ph.jqtiplus.running.ItemProcessingContext)

Example 4 with ItemSessionState

use of uk.ac.ed.ph.jqtiplus.state.ItemSessionState in project OpenOLAT by OpenOLAT.

the class AssessmentTreeComponentRenderer method renderAssessmentItemAttempts.

private void renderAssessmentItemAttempts(StringOutput sb, AssessmentTreeComponent component, TestPlanNode itemNode, Translator translator) {
    ItemProcessingContext itemProcessingContext = component.getItemSessionState(itemNode);
    ItemSessionState itemSessionState = itemProcessingContext.getItemSessionState();
    // attempts
    int numOfAttempts = itemSessionState.getNumAttempts();
    int maxAttempts = 0;
    if (itemProcessingContext instanceof ItemSessionController) {
        ItemSessionController itemSessionController = (ItemSessionController) itemProcessingContext;
        maxAttempts = itemSessionController.getItemSessionControllerSettings().getMaxAttempts();
    }
    sb.append("<span class='o_assessmentitem_attempts ");
    if (maxAttempts > 0) {
        if (maxAttempts - numOfAttempts > 0) {
            sb.append("o_assessmentitem_attempts_limited");
        } else {
            sb.append("o_assessmentitem_attempts_nomore");
        }
        String title = translator.translate("attemptsleft", new String[] { Integer.toString((maxAttempts - numOfAttempts)) });
        sb.append("' title=\"").append(StringHelper.escapeHtml(title)).append("\">");
        sb.append(numOfAttempts).append(" / ").append(Integer.toString(maxAttempts));
    } else {
        sb.append("'>").append(numOfAttempts);
    }
    sb.append("</span>");
}
Also used : ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ItemSessionController(uk.ac.ed.ph.jqtiplus.running.ItemSessionController) ItemProcessingContext(uk.ac.ed.ph.jqtiplus.running.ItemProcessingContext)

Example 5 with ItemSessionState

use of uk.ac.ed.ph.jqtiplus.state.ItemSessionState in project OpenOLAT by OpenOLAT.

the class InteractionResultComponentRenderer method render.

@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    InteractionResultComponent cmp = (InteractionResultComponent) source;
    Interaction interaction = cmp.getInteraction();
    ResolvedAssessmentItem resolvedAssessmentItem = cmp.getResolvedAssessmentItem();
    ItemSessionState itemSessionState = cmp.getItemSessionState();
    AssessmentRenderer assessmentRenderer = new AssessmentRenderer(renderer);
    if (cmp.isShowSolution()) {
        assessmentRenderer.setSolutionAllowed(true);
        assessmentRenderer.setSolutionMode(true);
    } else {
        assessmentRenderer.setReviewMode(true);
    }
    if (interaction instanceof Block) {
        renderBlock(assessmentRenderer, sb, cmp, resolvedAssessmentItem, itemSessionState, (Block) interaction, ubu, translator);
    } else if (interaction instanceof Flow) {
        renderFlow(assessmentRenderer, sb, cmp, resolvedAssessmentItem, itemSessionState, (Flow) interaction, ubu, translator);
    }
}
Also used : Interaction(uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) Block(uk.ac.ed.ph.jqtiplus.node.content.basic.Block) Flow(uk.ac.ed.ph.jqtiplus.node.content.basic.Flow)

Aggregations

ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)88 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)30 Date (java.util.Date)28 HashMap (java.util.HashMap)28 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)28 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)26 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)24 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)24 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)22 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)20 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)20 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)20 ItemSessionController (uk.ac.ed.ph.jqtiplus.running.ItemSessionController)20 ArrayList (java.util.ArrayList)18 Map (java.util.Map)18 ResponseData (uk.ac.ed.ph.jqtiplus.types.ResponseData)18 Interaction (uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction)16 List (java.util.List)14 Block (uk.ac.ed.ph.jqtiplus.node.content.basic.Block)12 Flow (uk.ac.ed.ph.jqtiplus.node.content.basic.Flow)12