Search in sources :

Example 11 with AssessmentEntryStatus

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

the class IQTESTCourseNode method pullAssessmentTestSession.

public void pullAssessmentTestSession(AssessmentTestSession session, UserCourseEnvironment assessedUserCourseenv, Identity coachingIdentity, Role by) {
    Boolean visibility;
    AssessmentEntryStatus assessmentStatus;
    if (IQEditController.CORRECTION_MANUAL.equals(getModuleConfiguration().getStringValue(IQEditController.CONFIG_CORRECTION_MODE))) {
        assessmentStatus = AssessmentEntryStatus.inReview;
        visibility = Boolean.FALSE;
    } else {
        assessmentStatus = AssessmentEntryStatus.done;
        visibility = Boolean.TRUE;
    }
    ScoreEvaluation sceval = new ScoreEvaluation(session.getScore().floatValue(), session.getPassed(), assessmentStatus, visibility, Boolean.TRUE, 1.0d, AssessmentRunStatus.done, session.getKey());
    updateUserScoreEvaluation(sceval, assessedUserCourseenv, coachingIdentity, true, by);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus)

Example 12 with AssessmentEntryStatus

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

the class IdentityListCourseNodeController method getSearchParameters.

protected SearchAssessedIdentityParams getSearchParameters() {
    SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(courseEntry, courseNode.getIdent(), referenceEntry, assessmentCallback);
    List<FlexiTableFilter> filters = tableEl.getSelectedFilters();
    List<FlexiTableFilter> extendedFilters = tableEl.getSelectedExtendedFilters();
    List<AssessmentEntryStatus> assessmentStatus = null;
    if (filters != null && filters.size() > 0) {
        assessmentStatus = new ArrayList<>(filters.size());
        for (FlexiTableFilter filter : filters) {
            if ("passed".equals(filter.getFilter())) {
                params.setPassed(true);
            } else if ("failed".equals(filter.getFilter())) {
                params.setFailed(true);
            } else if (AssessmentEntryStatus.isValueOf(filter.getFilter())) {
                assessmentStatus.add(AssessmentEntryStatus.valueOf(filter.getFilter()));
            }
        }
    }
    params.setAssessmentStatus(assessmentStatus);
    List<Long> businessGroupKeys = null;
    if (group != null) {
        businessGroupKeys = Collections.singletonList(group.getKey());
    } else if (extendedFilters != null && extendedFilters.size() > 0) {
        businessGroupKeys = new ArrayList<>(extendedFilters.size());
        for (FlexiTableFilter extendedFilter : extendedFilters) {
            if (StringHelper.isLong(extendedFilter.getFilter())) {
                businessGroupKeys.add(Long.parseLong(extendedFilter.getFilter()));
            }
        }
    }
    params.setBusinessGroupKeys(businessGroupKeys);
    params.setSearchString(tableEl.getQuickSearchString());
    return params;
}
Also used : SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) ArrayList(java.util.ArrayList) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus)

Example 13 with AssessmentEntryStatus

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

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 14 with AssessmentEntryStatus

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

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)

Example 15 with AssessmentEntryStatus

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

the class PortfolioServiceImpl method updateAssessmentEntry.

private void updateAssessmentEntry(Identity assessedIdentity, Binder binder, Set<AssessmentSection> assessmentSections, Identity coachingIdentity) {
    boolean allPassed = true;
    int totalSectionPassed = 0;
    int totalSectionClosed = 0;
    BigDecimal totalScore = new BigDecimal("0.0");
    AssessmentEntryStatus binderStatus = null;
    for (AssessmentSection assessmentSection : assessmentSections) {
        if (assessmentSection.getScore() != null) {
            totalScore = totalScore.add(assessmentSection.getScore());
        }
        if (assessmentSection.getPassed() != null && assessmentSection.getPassed().booleanValue()) {
            allPassed &= true;
            totalSectionPassed++;
        }
        Section section = assessmentSection.getSection();
        if (section.getSectionStatus() == SectionStatus.closed) {
            totalSectionClosed++;
        }
    }
    Boolean totalPassed = null;
    if (totalSectionClosed == assessmentSections.size()) {
        totalPassed = new Boolean(allPassed);
    } else {
        if (assessmentSections.size() == totalSectionPassed) {
            totalPassed = Boolean.TRUE;
        }
        binderStatus = AssessmentEntryStatus.inProgress;
    }
    // order status from the entry / section
    RepositoryEntry entry = binder.getEntry();
    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;
            ScoreEvaluation scoreEval = new ScoreEvaluation(totalScore.floatValue(), totalPassed, binderStatus, true, true, null, null, binder.getKey());
            UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
            pfNode.updateUserScoreEvaluation(scoreEval, userCourseEnv, coachingIdentity, false, Role.coach);
        }
    } else {
        OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
        RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
        AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
        assessmentEntry.setScore(totalScore);
        assessmentEntry.setPassed(totalPassed);
        assessmentEntry.setAssessmentStatus(binderStatus);
        assessmentService.updateAssessmentEntry(assessmentEntry);
    }
}
Also used : PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) OLATResource(org.olat.resource.OLATResource) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) BigDecimal(java.math.BigDecimal) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean)

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