Search in sources :

Example 31 with AssessmentEntry

use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.

the class AssessmentItemEditorController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (tabbedPane == source) {
        Controller selectedCtrl = tabbedPane.getSelectedController();
        if (selectedCtrl instanceof SyncAssessmentItem) {
            ((SyncAssessmentItem) selectedCtrl).sync(ureq, itemBuilder);
        } else if (selectedCtrl == displayCtrl) {
            if (testEntry != null) {
                AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(getIdentity(), null, testEntry, null, testEntry);
                displayCtrl = new AssessmentItemPreviewController(ureq, getWindowControl(), resolvedAssessmentItem, itemRef, testEntry, assessmentEntry, rootDirectory, itemFile);
            } else {
                displayCtrl = new AssessmentItemPreviewController(ureq, getWindowControl(), resolvedAssessmentItem, rootDirectory, itemFile);
            }
            listenTo(displayCtrl);
            tabbedPane.replaceTab(displayTabPosition, displayCtrl);
        } else if (selectedCtrl == solutionCtrl) {
            solutionCtrl = new AssessmentItemPreviewSolutionController(ureq, getWindowControl(), resolvedAssessmentItem, rootDirectory, itemFile);
            listenTo(displayCtrl);
            tabbedPane.replaceTab(solutionTabPosition, solutionCtrl);
        }
    }
}
Also used : ChoiceScoreController(org.olat.ims.qti21.ui.editor.interactions.ChoiceScoreController) FIBEditorController(org.olat.ims.qti21.ui.editor.interactions.FIBEditorController) HottextEditorController(org.olat.ims.qti21.ui.editor.interactions.HottextEditorController) MatchEditorController(org.olat.ims.qti21.ui.editor.interactions.MatchEditorController) HotspotChoiceScoreController(org.olat.ims.qti21.ui.editor.interactions.HotspotChoiceScoreController) MatchScoreController(org.olat.ims.qti21.ui.editor.interactions.MatchScoreController) UploadEditorController(org.olat.ims.qti21.ui.editor.interactions.UploadEditorController) BasicController(org.olat.core.gui.control.controller.BasicController) KPrimEditorController(org.olat.ims.qti21.ui.editor.interactions.KPrimEditorController) AssessmentItemDisplayController(org.olat.ims.qti21.ui.AssessmentItemDisplayController) MultipleChoiceEditorController(org.olat.ims.qti21.ui.editor.interactions.MultipleChoiceEditorController) HotspotEditorController(org.olat.ims.qti21.ui.editor.interactions.HotspotEditorController) FIBScoreController(org.olat.ims.qti21.ui.editor.interactions.FIBScoreController) EssayEditorController(org.olat.ims.qti21.ui.editor.interactions.EssayEditorController) TrueFalseEditorController(org.olat.ims.qti21.ui.editor.interactions.TrueFalseEditorController) SingleChoiceEditorController(org.olat.ims.qti21.ui.editor.interactions.SingleChoiceEditorController) Controller(org.olat.core.gui.control.Controller) DrawingEditorController(org.olat.ims.qti21.ui.editor.interactions.DrawingEditorController) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 32 with AssessmentEntry

use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.

the class IQRunController method exposeUserTestDataToVC.

private void exposeUserTestDataToVC(UserRequest ureq) {
    // config : show score info
    Object enableScoreInfoObject = modConfig.get(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
    if (enableScoreInfoObject != null) {
        myContent.contextPut("enableScoreInfo", enableScoreInfoObject);
    } else {
        myContent.contextPut("enableScoreInfo", Boolean.TRUE);
    }
    // configuration data
    myContent.contextPut("attemptsConfig", modConfig.get(IQEditController.CONFIG_KEY_ATTEMPTS));
    // user data
    Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
    if (courseNode instanceof PersistentAssessableCourseNode) {
        PersistentAssessableCourseNode acn = (PersistentAssessableCourseNode) courseNode;
        AssessmentEntry assessmentEntry = acn.getUserAssessmentEntry(userCourseEnv);
        if (assessmentEntry == null) {
            myContent.contextPut("blockAfterSuccess", Boolean.FALSE);
            myContent.contextPut("score", null);
            myContent.contextPut("hasPassedValue", Boolean.FALSE);
            myContent.contextPut("passed", Boolean.FALSE);
            myContent.contextPut("comment", null);
            myContent.contextPut("docs", null);
            myContent.contextPut("attempts", 0);
        } else {
            // block if test passed (and config set to check it)
            Boolean blockAfterSuccess = modConfig.getBooleanEntry(IQEditController.CONFIG_KEY_BLOCK_AFTER_SUCCESS);
            Boolean blocked = Boolean.FALSE;
            if (blockAfterSuccess != null && blockAfterSuccess.booleanValue()) {
                Boolean passed = assessmentEntry.getPassed();
                if (passed != null && passed.booleanValue()) {
                    blocked = Boolean.TRUE;
                }
            }
            myContent.contextPut("blockAfterSuccess", blocked);
            boolean resultsVisible = assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
            myContent.contextPut("resultsVisible", resultsVisible);
            myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
            myContent.contextPut("hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
            myContent.contextPut("passed", assessmentEntry.getPassed());
            if (resultsVisible) {
                if (acn.hasCommentConfigured()) {
                    StringBuilder comment = Formatter.stripTabsAndReturns(assessmentEntry.getComment());
                    myContent.contextPut("comment", StringHelper.xssScan(comment));
                    myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
                }
                if (acn.hasIndividualAsssessmentDocuments()) {
                    List<File> docs = acn.getIndividualAssessmentDocuments(userCourseEnv);
                    String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
                    myContent.contextPut("docsMapperUri", mapperUri);
                    myContent.contextPut("docs", docs);
                    myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
                }
            }
            myContent.contextPut("attempts", assessmentEntry.getAttempts() == null ? 0 : assessmentEntry.getAttempts());
        }
    }
    UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
    myContent.contextPut("log", am.getUserNodeLog(courseNode, identity));
    exposeResults(ureq);
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) Identity(org.olat.core.id.Identity) DocumentsMapper(org.olat.course.nodes.ms.DocumentsMapper) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Example 33 with AssessmentEntry

use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method doDownloadSignature.

private void doDownloadSignature(UserRequest ureq) {
    MediaResource resource = null;
    if (courseNode instanceof IQTESTCourseNode) {
        IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
        AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
        AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
        File signature = qtiService.getAssessmentResultSignature(session);
        if (signature.exists()) {
            resource = new DownloadeableMediaResource(signature);
        }
    }
    if (resource == null) {
        resource = new NotFoundMediaResource();
    }
    ureq.getDispatchResult().setResultingMediaResource(resource);
}
Also used : NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) DownloadeableMediaResource(org.olat.fileresource.DownloadeableMediaResource) MediaResource(org.olat.core.gui.media.MediaResource) DownloadeableMediaResource(org.olat.fileresource.DownloadeableMediaResource) NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Example 34 with AssessmentEntry

use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.

the class BasicLTICourseNode method getUserScoreEvaluation.

@Override
public AssessmentEvaluation getUserScoreEvaluation(UserCourseEnvironment userCourseEnv) {
    AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
    Identity mySelf = userCourseEnv.getIdentityEnvironment().getIdentity();
    AssessmentEntry entry = am.getAssessmentEntry(this, mySelf);
    return getUserScoreEvaluation(entry);
}
Also used : AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 35 with AssessmentEntry

use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.

the class OLATUpgrade_11_2_1 method processTaskCourseNode.

private boolean processTaskCourseNode(ICourse course, RepositoryEntry entry, TACourseNode courseNode) {
    List<AssessmentEntry> assessmentEntries = getAssessmentEntries(entry, courseNode);
    if (assessmentEntries.size() > 0) {
        CourseEnvironment courseEnv = course.getCourseEnvironment();
        CoursePropertyManager cpm = courseEnv.getCoursePropertyManager();
        File dropbox = new File(FolderConfig.getCanonicalRoot(), DropboxController.getDropboxPathRelToFolderRoot(courseEnv, courseNode));
        File returnBox = new File(FolderConfig.getCanonicalRoot(), ReturnboxController.getReturnboxPathRelToFolderRoot(courseEnv, courseNode));
        for (AssessmentEntry assessmentEntry : assessmentEntries) {
            Identity assessedIdentity = assessmentEntry.getIdentity();
            boolean changed = false;
            List<Property> properties = cpm.findCourseNodeProperties(courseNode, assessedIdentity, null, TaskController.PROP_ASSIGNED);
            if (properties != null && properties.size() > 0) {
                assessmentEntry.setAssessmentStatus(AssessmentEntryStatus.inProgress);
            } else {
                File identityDropbox = new File(dropbox, assessedIdentity.getName());
                File identityReturnBox = new File(returnBox, assessedIdentity.getName());
                if (hasBoxedFiles(identityDropbox, identityReturnBox)) {
                    assessmentEntry.setAssessmentStatus(AssessmentEntryStatus.inProgress);
                }
            }
            if (changed) {
                courseEnv.getAssessmentManager().updateAssessmentEntry(assessmentEntry);
            }
        }
        dbInstance.commitAndCloseSession();
    }
    return true;
}
Also used : CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Aggregations

AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)150 Identity (org.olat.core.id.Identity)88 RepositoryEntry (org.olat.repository.RepositoryEntry)70 Test (org.junit.Test)50 ICourse (org.olat.course.ICourse)38 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)32 File (java.io.File)26 Date (java.util.Date)26 HashMap (java.util.HashMap)22 BigDecimal (java.math.BigDecimal)20 ArrayList (java.util.ArrayList)20 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)20 UserNodeAuditManager (org.olat.course.auditing.UserNodeAuditManager)16 CourseNode (org.olat.course.nodes.CourseNode)16 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)16 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)14 AssessmentChangedEvent (org.olat.course.assessment.AssessmentChangedEvent)12 AssessmentManager (org.olat.course.assessment.AssessmentManager)12 BusinessGroup (org.olat.group.BusinessGroup)12 List (java.util.List)10