Search in sources :

Example 21 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentDetailsController method getSignatureOptions.

private DigitalSignatureOptions getSignatureOptions(AssessmentTestSession session) {
    RepositoryEntry sessionTestEntry = session.getTestEntry();
    QTI21DeliveryOptions deliveryOptions = qtiService.getDeliveryOptions(sessionTestEntry);
    boolean digitalSignature = deliveryOptions.isDigitalSignature();
    boolean sendMail = deliveryOptions.isDigitalSignatureMail();
    if (courseNode != null) {
        ModuleConfiguration config = courseNode.getModuleConfiguration();
        digitalSignature = config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE, deliveryOptions.isDigitalSignature());
        sendMail = config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE_SEND_MAIL, deliveryOptions.isDigitalSignatureMail());
    }
    DigitalSignatureOptions options = new DigitalSignatureOptions(digitalSignature, sendMail, entry, testEntry);
    if (digitalSignature) {
        if (courseNode == null) {
            AssessmentEntryOutcomesListener.decorateResourceConfirmation(entry, testEntry, session, options, null, getLocale());
        } else {
            CourseEnvironment courseEnv = CourseFactory.loadCourse(entry).getCourseEnvironment();
            QTI21AssessmentRunController.decorateCourseConfirmation(session, options, courseEnv, courseNode, sessionTestEntry, null, getLocale());
        }
    }
    return options;
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) ModuleConfiguration(org.olat.modules.ModuleConfiguration) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) DigitalSignatureOptions(org.olat.ims.qti21.model.DigitalSignatureOptions) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 22 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentDetailsController method doCorrection.

private void doCorrection(UserRequest ureq, AssessmentTestSession session) {
    File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
    ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
    ManifestBuilder manifestBuilder = ManifestBuilder.read(new File(unzippedDirRoot, "imsmanifest.xml"));
    TestSessionState testSessionState = qtiService.loadTestSessionState(session);
    CorrectionOverviewModel model = new CorrectionOverviewModel(entry, subIdent, testEntry, resolvedAssessmentTest, manifestBuilder, Collections.singletonMap(assessedIdentity, session), Collections.singletonMap(assessedIdentity, testSessionState));
    correctionCtrl = new CorrectionIdentityAssessmentItemListController(ureq, getWindowControl(), stackPanel, model, session, assessedIdentity);
    listenTo(correctionCtrl);
    stackPanel.pushController(translate("correction"), correctionCtrl);
}
Also used : CorrectionOverviewModel(org.olat.ims.qti21.ui.assessment.CorrectionOverviewModel) ManifestBuilder(org.olat.ims.qti21.model.xml.ManifestBuilder) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) CorrectionIdentityAssessmentItemListController(org.olat.ims.qti21.ui.assessment.CorrectionIdentityAssessmentItemListController) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) File(java.io.File)

Example 23 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class CorrectionIdentityInteractionsController method initFormExtendedTextInteraction.

private ItemBodyResultFormItem initFormExtendedTextInteraction(TestPlanNodeKey testPlanNodeKey, TestSessionState testSessionState, AssessmentTestSession assessmentTestSession, FormItemContainer layoutCont) {
    ItemSessionState sessionState = testSessionState.getItemSessionStates().get(testPlanNodeKey);
    String responseId = "responseItem_" + id + "_" + count++;
    ItemBodyResultFormItem responseFormItem = new ItemBodyResultFormItem(responseId, resolvedAssessmentItem);
    responseFormItem.setItemSessionState(sessionState);
    responseFormItem.setCandidateSessionContext(new TerminatedStaticCandidateSessionContext(assessmentTestSession));
    responseFormItem.setResolvedAssessmentTest(resolvedAssessmentTest);
    responseFormItem.setResourceLocator(inputResourceLocator);
    responseFormItem.setAssessmentObjectUri(assessmentObjectUri);
    responseFormItem.setMapperUri(mapperUri);
    layoutCont.add(responseFormItem);
    return responseFormItem;
}
Also used : ItemBodyResultFormItem(org.olat.ims.qti21.ui.components.ItemBodyResultFormItem) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState)

Example 24 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class CorrectionIdentityInteractionsController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    TestPlanNode node = correction.getItemNode();
    TestPlanNodeKey testPlanNodeKey = node.getKey();
    AssessmentItemSession itemSession = correction.getItemSession();
    AssessmentTestSession testSession = correction.getTestSession();
    TestSessionState testSessionState = correction.getTestSessionState();
    answerItem = initFormExtendedTextInteraction(testPlanNodeKey, testSessionState, testSession, formLayout);
    formLayout.add("answer", answerItem);
    viewSolutionButton = uifactory.addFormLink("view.solution", formLayout);
    viewSolutionButton.setIconLeftCSS("o_icon o_icon_open_togglebox");
    solutionItem = initFormExtendedTextInteraction(testPlanNodeKey, testSessionState, testSession, formLayout);
    solutionItem.setVisible(false);
    solutionItem.setShowSolution(true);
    formLayout.add("solution", solutionItem);
    List<InteractionResultFormItem> responseItems = new ArrayList<>(interactions.size());
    for (Interaction interaction : interactions) {
        if (interaction instanceof UploadInteraction || interaction instanceof DrawingInteraction || interaction instanceof ExtendedTextInteraction) {
            manualScore = true;
            File submissionDir = qtiService.getSubmissionDirectory(testSession);
            if (submissionDir != null) {
                submissionDirectoryMaps.put(testSession.getKey(), submissionDir);
            }
        }
    }
    String mScore = "";
    String coachComment = "";
    if (itemSession != null) {
        if (itemSession.getManualScore() != null) {
            mScore = AssessmentHelper.getRoundedScore(itemSession.getManualScore());
        }
        coachComment = itemSession.getCoachComment();
    }
    FormLayoutContainer scoreCont = FormLayoutContainer.createDefaultFormLayout("score.container", getTranslator());
    formLayout.add("score.container", scoreCont);
    statusEl = uifactory.addStaticTextElement("status", "status", "", scoreCont);
    statusEl.setValue(getStatus());
    String fullname = userManager.getUserDisplayName(correction.getAssessedIdentity());
    if (manualScore) {
        scoreEl = uifactory.addTextElement("scoreItem", "score", 6, mScore, scoreCont);
    } else {
        overrideAutoScore = itemSession == null ? null : itemSession.getManualScore();
        String page = velocity_root + "/override_score.html";
        overrideScoreCont = FormLayoutContainer.createCustomFormLayout("extra.score", getTranslator(), page);
        overrideScoreCont.setRootForm(mainForm);
        scoreCont.add(overrideScoreCont);
        overrideScoreCont.setLabel("score", null);
        BigDecimal score = null;
        if (itemSession != null) {
            score = itemSession.getManualScore();
            if (score == null) {
                score = itemSession.getScore();
            }
        }
        overrideScoreCont.contextPut("score", AssessmentHelper.getRoundedScore(score));
        overrideScoreButton = uifactory.addFormLink("override.score", overrideScoreCont, Link.BUTTON_SMALL);
        overrideScoreButton.setDomReplacementWrapperRequired(false);
    }
    commentEl = uifactory.addTextAreaElement("commentItem", "comment", 2500, 4, 60, false, coachComment, scoreCont);
    commentEl.setHelpText(translate("comment.help"));
    IdentityAssessmentItemWrapper wrapper = new IdentityAssessmentItemWrapper(fullname, assessmentItem, correction, responseItems, scoreEl, commentEl, statusEl);
    toReviewEl = uifactory.addCheckboxesHorizontal("to.review", "to.review", scoreCont, onKeys, new String[] { "" });
    if (itemSession != null && itemSession.isToReview()) {
        toReviewEl.select(onKeys[0], true);
    }
    Double minScore = QtiNodesExtractor.extractMinScore(assessmentItem);
    Double maxScore = QtiNodesExtractor.extractMaxScore(assessmentItem);
    if (maxScore != null) {
        if (minScore == null) {
            minScore = 0.0d;
        }
        wrapper.setMinScore(AssessmentHelper.getRoundedScore(minScore));
        wrapper.setMaxScore(AssessmentHelper.getRoundedScore(maxScore));
        wrapper.setMinScoreVal(minScore);
        wrapper.setMaxScoreVal(maxScore);
        if (scoreEl != null) {
            scoreEl.setExampleKey("correction.min.max.score", new String[] { wrapper.getMinScore(), wrapper.getMaxScore() });
        }
        if (overrideScoreCont != null) {
            overrideScoreCont.setExampleKey("correction.min.max.score", new String[] { wrapper.getMinScore(), wrapper.getMaxScore() });
        }
    }
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("interactionWrapper", wrapper);
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) UploadInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.UploadInteraction) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) DrawingInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.DrawingInteraction) UploadInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.UploadInteraction) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) Interaction(uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) InteractionResultFormItem(org.olat.ims.qti21.ui.components.InteractionResultFormItem) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) DrawingInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.DrawingInteraction) BigDecimal(java.math.BigDecimal) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) File(java.io.File) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 25 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class CorrectionOverviewModel method loadLastSessions.

public Map<Identity, AssessmentTestSession> loadLastSessions() {
    Set<Identity> identitiesSet = new HashSet<>(assessedIdentities);
    List<AssessmentTestSession> sessions = CoreSpringFactory.getImpl(QTI21Service.class).getAssessmentTestSessions(courseEntry, subIdent, testEntry);
    Map<Identity, AssessmentTestSession> identityToSessions = new HashMap<>();
    for (AssessmentTestSession session : sessions) {
        // filter last session / user
        Identity assessedIdentity = session.getIdentity();
        if (!identitiesSet.contains(assessedIdentity)) {
            continue;
        }
        Date fDate = session.getFinishTime();
        if (fDate == null) {
        // not terminated
        } else {
            if (identityToSessions.containsKey(assessedIdentity)) {
                AssessmentTestSession currentSession = identityToSessions.get(assessedIdentity);
                Date currentFDate = currentSession.getFinishTime();
                if (fDate.after(currentFDate)) {
                    identityToSessions.put(assessedIdentity, session);
                }
            } else {
                identityToSessions.put(assessedIdentity, session);
            }
        }
    }
    setLastSessions(identityToSessions);
    return identityToSessions;
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) QTI21Service(org.olat.ims.qti21.QTI21Service) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Identity(org.olat.core.id.Identity) Date(java.util.Date) HashSet(java.util.HashSet)

Aggregations

AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)107 Identity (org.olat.core.id.Identity)45 RepositoryEntry (org.olat.repository.RepositoryEntry)36 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)32 File (java.io.File)30 ArrayList (java.util.ArrayList)24 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)24 Date (java.util.Date)22 Test (org.junit.Test)20 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)20 HashMap (java.util.HashMap)17 InMemoryAssessmentTestSession (org.olat.ims.qti21.model.InMemoryAssessmentTestSession)14 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)14 AssessmentResponse (org.olat.ims.qti21.AssessmentResponse)12 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)12 IOException (java.io.IOException)10 BigDecimal (java.math.BigDecimal)10 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)10 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)10 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)10