Search in sources :

Example 21 with AssessmentEntryStatus

use of org.olat.modules.assessment.model.AssessmentEntryStatus in project openolat by klemens.

the class PortfolioServiceImpl method getAssessmentStatus.

@Override
public AssessmentEntryStatus getAssessmentStatus(Identity assessedIdentity, BinderRef binderRef) {
    Binder binder = binderDao.loadByKey(binderRef.getKey());
    RepositoryEntry entry = binder.getEntry();
    AssessmentEntryStatus status = null;
    if ("CourseModule".equals(entry.getOlatResource().getResourceableTypeName())) {
        ICourse course = CourseFactory.loadCourse(entry);
        CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent());
        if (courseNode instanceof PortfolioCourseNode) {
            PortfolioCourseNode pfNode = (PortfolioCourseNode) courseNode;
            UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
            AssessmentEvaluation eval = pfNode.getUserScoreEvaluation(userCourseEnv);
            status = eval.getAssessmentStatus();
        }
    } else {
        OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
        RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
        AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
        status = assessmentEntry.getAssessmentStatus();
    }
    return status;
}
Also used : Binder(org.olat.modules.portfolio.Binder) AssessedBinder(org.olat.modules.portfolio.model.AssessedBinder) SynchedBinder(org.olat.modules.portfolio.model.SynchedBinder) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) AssessmentEvaluation(org.olat.course.run.scoring.AssessmentEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) OLATResource(org.olat.resource.OLATResource) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 22 with AssessmentEntryStatus

use of org.olat.modules.assessment.model.AssessmentEntryStatus in project openolat by klemens.

the class OLATUpgrade_11_0_0 method processAssessmentPropertyForTA.

/**
 * Search first for the status of the task, if not found, see if some documents
 * where dropped or returned, in this case, the status is in review, if not
 * the status is not started.
 *
 * @param assessedIdentity
 * @param entry
 * @param tNode
 * @param course
 */
private void processAssessmentPropertyForTA(Identity assessedIdentity, AssessmentEntryImpl entry, TACourseNode tNode, ICourse course) {
    List<Property> samples = course.getCourseEnvironment().getCoursePropertyManager().findCourseNodeProperties(tNode, assessedIdentity, null, TaskController.PROP_ASSIGNED);
    if (samples.size() > 0) {
        String details = samples.get(0).getStringValue();
        entry.setDetails(details);
    }
    Property statusProperty = course.getCourseEnvironment().getCoursePropertyManager().findCourseNodeProperty(tNode, assessedIdentity, null, StatusManager.PROPERTY_KEY_STATUS);
    AssessmentEntryStatus assessmentStatus = null;
    if (statusProperty != null) {
        String status = statusProperty.getStringValue();
        if (status != null) {
            switch(status) {
                case StatusForm.STATUS_VALUE_NOT_OK:
                    assessmentStatus = AssessmentEntryStatus.inProgress;
                    break;
                case StatusForm.STATUS_VALUE_OK:
                    assessmentStatus = AssessmentEntryStatus.done;
                    break;
                case StatusForm.STATUS_VALUE_WORKING_ON:
                    assessmentStatus = AssessmentEntryStatus.inProgress;
                    break;
                case StatusForm.STATUS_VALUE_UNDEFINED:
                    assessmentStatus = AssessmentEntryStatus.inProgress;
                    break;
            }
        }
    }
    if (assessmentStatus == null) {
        String dropbox = DropboxController.getDropboxPathRelToFolderRoot(course.getCourseEnvironment(), tNode) + File.separator + assessedIdentity.getName();
        OlatRootFolderImpl dropBox = new OlatRootFolderImpl(dropbox, null);
        boolean hasDropped = (dropBox.getBasefile().exists() && dropBox.getBasefile().listFiles(SystemFileFilter.FILES_ONLY).length > 0);
        String returnbox = ReturnboxController.getReturnboxPathRelToFolderRoot(course.getCourseEnvironment(), tNode) + File.separator + assessedIdentity.getName();
        OlatRootFolderImpl returnBox = new OlatRootFolderImpl(returnbox, null);
        boolean hasReturned = (returnBox.getBasefile().exists() && returnBox.getBasefile().listFiles(SystemFileFilter.FILES_ONLY).length > 0);
        if (hasReturned || hasDropped) {
            assessmentStatus = AssessmentEntryStatus.inReview;
        } else {
            assessmentStatus = AssessmentEntryStatus.notStarted;
        }
    }
    entry.setAssessmentStatus(assessmentStatus);
}
Also used : OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) Property(org.olat.properties.Property) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus)

Example 23 with AssessmentEntryStatus

use of org.olat.modules.assessment.model.AssessmentEntryStatus in project openolat by klemens.

the class IQIdentityListCourseNodeController method doUpdateCourseNode.

private void doUpdateCourseNode(List<AssessmentTestSession> testSessionsToComplete, AssessmentTest assessmentTest, AssessmentEntryStatus status) {
    if (testSessionsToComplete == null || testSessionsToComplete.isEmpty())
        return;
    Double cutValue = QtiNodesExtractor.extractCutValue(assessmentTest);
    for (AssessmentTestSession testSession : testSessionsToComplete) {
        UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(testSession.getIdentity(), getCourseEnvironment());
        ScoreEvaluation scoreEval = ((IQTESTCourseNode) courseNode).getUserScoreEvaluation(assessedUserCourseEnv);
        BigDecimal finalScore = testSession.getFinalScore();
        Float score = finalScore == null ? null : finalScore.floatValue();
        Boolean passed = scoreEval.getPassed();
        if (testSession.getManualScore() != null && finalScore != null && cutValue != null) {
            boolean calculated = finalScore.compareTo(BigDecimal.valueOf(cutValue.doubleValue())) >= 0;
            passed = Boolean.valueOf(calculated);
        }
        AssessmentEntryStatus finalStatus = status == null ? scoreEval.getAssessmentStatus() : status;
        ScoreEvaluation manualScoreEval = new ScoreEvaluation(score, passed, finalStatus, scoreEval.getUserVisible(), scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), testSession.getKey());
        ((IQTESTCourseNode) courseNode).updateUserScoreEvaluation(manualScoreEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) BigDecimal(java.math.BigDecimal)

Example 24 with AssessmentEntryStatus

use of org.olat.modules.assessment.model.AssessmentEntryStatus in project openolat by klemens.

the class IQRunController method submitAssessment.

@Override
public void submitAssessment(AssessmentInstance ai) {
    if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
        AssessmentContext ac = ai.getAssessmentContext();
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        Boolean fullyAssed = am.getNodeFullyAssessed(courseNode, getIdentity());
        String correctionMode = courseNode.getModuleConfiguration().getStringValue(IQEditController.CONFIG_CORRECTION_MODE);
        Boolean userVisibility;
        AssessmentEntryStatus assessmentStatus;
        if (IQEditController.CORRECTION_MANUAL.equals(correctionMode)) {
            assessmentStatus = AssessmentEntryStatus.inReview;
            userVisibility = Boolean.FALSE;
        } else {
            assessmentStatus = AssessmentEntryStatus.done;
            userVisibility = Boolean.TRUE;
        }
        ScoreEvaluation sceval = new ScoreEvaluation(ac.getScore(), ac.isPassed(), assessmentStatus, userVisibility, fullyAssed, null, null, ai.getAssessID());
        // assessment nodes are assessable
        AssessableCourseNode acn = (AssessableCourseNode) courseNode;
        acn.updateUserScoreEvaluation(sceval, userCourseEnv, getIdentity(), true, Role.user);
        // Mark publisher for notifications
        Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
        assessmentNotificationsHandler.markPublisherNews(getIdentity(), courseId);
        if (!assessmentStopped) {
            assessmentStopped = true;
            AssessmentEvent assessmentStoppedEvent = new AssessmentEvent(AssessmentEvent.TYPE.STOPPED, userSession);
            singleUserEventCenter.deregisterFor(this, assessmentInstanceOres);
            singleUserEventCenter.fireEventToListenersOf(assessmentStoppedEvent, assessmentEventOres);
        }
    } else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY)) {
        // save number of attempts
        // although this is not an assessable node we still use the assessment
        // manager since this one uses caching
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        am.incrementNodeAttempts(courseNode, getIdentity(), userCourseEnv, Role.user);
    } else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SELF)) {
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        am.incrementNodeAttempts(courseNode, getIdentity(), userCourseEnv, Role.user);
    }
}
Also used : AssessmentContext(org.olat.ims.qti.container.AssessmentContext) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentManager(org.olat.course.assessment.AssessmentManager) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus)

Example 25 with AssessmentEntryStatus

use of org.olat.modules.assessment.model.AssessmentEntryStatus in project openolat by klemens.

the class QTI21AssessmentRunController method submit.

@Override
public void submit(Float score, Boolean pass, Double completion, Long assessmentId) {
    if (anonym) {
        assessmentNotificationsHandler.markPublisherNews(getIdentity(), userCourseEnv.getCourseEnvironment().getCourseResourceableId());
        return;
    }
    if (courseNode instanceof IQTESTCourseNode) {
        Boolean visibility;
        AssessmentEntryStatus assessmentStatus;
        if (IQEditController.CORRECTION_MANUAL.equals(courseNode.getModuleConfiguration().getStringValue(IQEditController.CONFIG_CORRECTION_MODE))) {
            assessmentStatus = AssessmentEntryStatus.inReview;
            visibility = Boolean.FALSE;
        } else {
            assessmentStatus = AssessmentEntryStatus.done;
            visibility = Boolean.TRUE;
        }
        ScoreEvaluation sceval = new ScoreEvaluation(score, pass, assessmentStatus, visibility, Boolean.TRUE, completion, AssessmentRunStatus.done, assessmentId);
        boolean increment = incrementAttempts.getAndSet(false);
        ((IQTESTCourseNode) courseNode).updateUserScoreEvaluation(sceval, userCourseEnv, getIdentity(), increment, Role.user);
        if (increment) {
            ThreadLocalUserActivityLogger.log(QTI21LoggingAction.QTI_CLOSE_IN_COURSE, getClass());
        }
        coordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new CompletionEvent(CompletionEvent.PROGRESS, courseNode.getIdent(), completion, AssessmentRunStatus.done, getIdentity().getKey()), userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseResource());
        assessmentNotificationsHandler.markPublisherNews(getIdentity(), userCourseEnv.getCourseEnvironment().getCourseResourceableId());
    } else if (courseNode instanceof SelfAssessableCourseNode) {
        boolean increment = incrementAttempts.getAndSet(false);
        if (increment) {
            ((SelfAssessableCourseNode) courseNode).incrementUserAttempts(userCourseEnv, Role.user);
        }
    }
}
Also used : IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) CompletionEvent(org.olat.modules.assessment.ui.event.CompletionEvent) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode)

Aggregations

AssessmentEntryStatus (org.olat.modules.assessment.model.AssessmentEntryStatus)30 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)10 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 BigDecimal (java.math.BigDecimal)6 ArrayList (java.util.ArrayList)6 Identity (org.olat.core.id.Identity)6 ICourse (org.olat.course.ICourse)6 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)6 HashMap (java.util.HashMap)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)4 SearchAssessedIdentityParams (org.olat.course.assessment.model.SearchAssessedIdentityParams)4 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)4 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)4 Section (org.olat.modules.portfolio.Section)4 CourseNode (org.olat.course.nodes.CourseNode)3 PortfolioCourseNode (org.olat.course.nodes.PortfolioCourseNode)3 SelfAssessableCourseNode (org.olat.course.nodes.SelfAssessableCourseNode)3 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)3