Search in sources :

Example 86 with ItemSessionState

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

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)

Example 87 with ItemSessionState

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

the class ItemBodyResultComponentRenderer method render.

@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    ItemBodyResultComponent cmp = (ItemBodyResultComponent) source;
    ResolvedAssessmentItem resolvedAssessmentItem = cmp.getResolvedAssessmentItem();
    AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
    ItemSessionState itemSessionState = cmp.getItemSessionState();
    AssessmentRenderer assessmentRenderer = new AssessmentRenderer(renderer);
    if (cmp.isShowSolution()) {
        assessmentRenderer.setSolutionAllowed(true);
        assessmentRenderer.setSolutionMode(true);
    } else {
        assessmentRenderer.setReviewMode(true);
    }
    assessmentItem.getItemBody().getBlocks().forEach((block) -> renderBlock(assessmentRenderer, sb, cmp, resolvedAssessmentItem, itemSessionState, block, ubu, translator));
}
Also used : ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)

Example 88 with ItemSessionState

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

the class UnkownItemEditorController 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));
    Long randomSeed = new Random().nextLong();
    sessionController.setRandomSeed(randomSeed);
    sessionController.initialize(new Date());
    sessionController.performTemplateProcessing(new Date());
    return sessionController;
}
Also used : ItemSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.ItemSessionControllerSettings) ItemProcessingMap(uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap) Random(java.util.Random) 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)

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