Search in sources :

Example 1 with AssessmentEntryStatus

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

the class BinderAssessmentController method loadModel.

private void loadModel() {
    List<AssessmentSection> aSections = portfolioService.getAssessmentSections(binder, null);
    Map<Section, AssessmentSection> aSectionsMap = new HashMap<>();
    for (AssessmentSection aSection : aSections) {
        aSectionsMap.put(aSection.getSection(), aSection);
    }
    // binder done only is an owner is present
    // and all owners have done the binder
    boolean binderDone = false;
    List<Identity> assessedIdentities = portfolioService.getMembers(binder, PortfolioRoles.owner.name());
    int countDone = 0;
    for (Identity assessedIdentity : assessedIdentities) {
        AssessmentEntryStatus status = portfolioService.getAssessmentStatus(assessedIdentity, binder);
        if (status == AssessmentEntryStatus.done) {
            countDone++;
        }
    }
    binderDone = (countDone > 0 && countDone == assessedIdentities.size());
    boolean allClosed = true;
    List<Section> sections = portfolioService.getSections(binder);
    List<AssessmentSectionWrapper> rows = new ArrayList<>();
    Map<Section, AssessmentSectionWrapper> sectionToRows = new HashMap<>();
    for (Section section : sections) {
        AssessmentSection assessmentSection = aSectionsMap.get(section);
        AssessmentSectionWrapper row = new AssessmentSectionWrapper(section, assessmentSection);
        sectionToRows.put(section, row);
        if (secCallback.canViewAssess(section) || secCallback.canAssess(section)) {
            rows.add(row);
        }
        allClosed &= section.getSectionStatus() == SectionStatus.closed;
    }
    List<Page> pages = portfolioService.getPages(binder, null);
    for (Page page : pages) {
        AssessmentSectionWrapper row = sectionToRows.get(page.getSection());
        if (row != null) {
            row.setNumOfPages(row.getNumOfPages() + 1);
        }
    }
    boolean allowedToAssess = false;
    boolean allowedToAssessBinder = secCallback.canAssess(binder);
    for (AssessmentSectionWrapper row : rows) {
        boolean canAssess = secCallback.canAssess(row.getSection());
        if (canAssess && !binderDone) {
            forgeAssessmentSection(row);
            allowedToAssess = true;
        }
    }
    reopenLink.setVisible(allowedToAssessBinder && binderDone);
    saveAndDoneLink.setVisible(allowedToAssessBinder && !binderDone && allClosed);
    saveButton.setVisible(allowedToAssess);
    cancelButton.setVisible(allowedToAssess);
    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Page(org.olat.modules.portfolio.Page) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Identity(org.olat.core.id.Identity)

Example 2 with AssessmentEntryStatus

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

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

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

the class AssessedIdentityListController method updateModel.

protected void updateModel(String searchString, List<FlexiTableFilter> filters, List<FlexiTableFilter> extendedFilters) {
    SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(testEntry, null, testEntry, assessmentCallback);
    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 (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(searchString);
    List<Identity> assessedIdentities = assessmentToolManager.getAssessedIdentities(getIdentity(), params);
    List<AssessmentEntry> assessmentEntries = assessmentToolManager.getAssessmentEntries(getIdentity(), params, null);
    Map<Long, AssessmentEntry> entryMap = new HashMap<>();
    assessmentEntries.stream().filter((entry) -> entry.getIdentity() != null).forEach((entry) -> entryMap.put(entry.getIdentity().getKey(), entry));
    Map<Long, Date> initialLaunchDates = userInfosMgr.getInitialLaunchDates(testEntry.getOlatResource());
    List<AssessedIdentityElementRow> rows = new ArrayList<>(assessedIdentities.size());
    for (Identity assessedIdentity : assessedIdentities) {
        AssessmentEntry entry = entryMap.get(assessedIdentity.getKey());
        AssessedIdentityElementRow row = new AssessedIdentityElementRow(assessedIdentity, entry, null, null, userPropertyHandlers, getLocale());
        row.setInitialCourseLaunchDate(initialLaunchDates.get(assessedIdentity.getKey()));
        rows.add(row);
    }
    usersTableModel.setObjects(rows);
    if (filters != null && filters.size() > 0 && filters.get(0) != null) {
        usersTableModel.filter(Collections.singletonList(filters.get(0)));
    }
    tableEl.reloadData();
    searchParams = params;
    updateTools(assessedIdentities);
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) Util(org.olat.core.util.Util) RepositoryHandlerFactory(org.olat.repository.handlers.RepositoryHandlerFactory) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) AssessmentToolManager(org.olat.course.assessment.AssessmentToolManager) Date(java.util.Date) UserCourseInformationsManager(org.olat.course.assessment.manager.UserCourseInformationsManager) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) RepositoyUIFactory(org.olat.repository.ui.RepositoyUIFactory) AssessmentToolOptions(org.olat.modules.assessment.AssessmentToolOptions) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) Map(java.util.Map) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) AssessmentModule(org.olat.course.assessment.AssessmentModule) WindowControl(org.olat.core.gui.control.WindowControl) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) IdentityCourseElementCols(org.olat.modules.assessment.ui.AssessedIdentityListTableModel.IdentityCourseElementCols) Component(org.olat.core.gui.components.Component) LinkFactory(org.olat.core.gui.components.link.LinkFactory) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) List(java.util.List) Align(org.olat.core.gui.components.stack.TooledStackedPanel.Align) Identity(org.olat.core.id.Identity) BaseSecurity(org.olat.basesecurity.BaseSecurity) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) HashMap(java.util.HashMap) RepositoryEntry(org.olat.repository.RepositoryEntry) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) ContextEntry(org.olat.core.id.context.ContextEntry) PassedCellRenderer(org.olat.course.assessment.bulk.PassedCellRenderer) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) StringHelper(org.olat.core.util.StringHelper) StateEntry(org.olat.core.id.context.StateEntry) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) BusinessGroupService(org.olat.group.BusinessGroupService) Link(org.olat.core.gui.components.link.Link) AssessmentStatusCellRenderer(org.olat.course.assessment.ui.tool.AssessmentStatusCellRenderer) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) SearchBusinessGroupParams(org.olat.group.model.SearchBusinessGroupParams) Controller(org.olat.core.gui.control.Controller) UserManager(org.olat.user.UserManager) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) AssessmentToolConstants(org.olat.course.assessment.ui.tool.AssessmentToolConstants) AssessedIdentityListProvider(org.olat.course.assessment.ui.tool.AssessedIdentityListProvider) BusinessGroup(org.olat.group.BusinessGroup) UserRequest(org.olat.core.gui.UserRequest) Collections(java.util.Collections) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Date(java.util.Date) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) Identity(org.olat.core.id.Identity)

Example 4 with AssessmentEntryStatus

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

the class GTAManagerImpl method syncAssessmentEntry.

private void syncAssessmentEntry(TaskImpl taskImpl, GTACourseNode cNode, Role by) {
    if (taskImpl == null || taskImpl.getTaskStatus() == null || cNode == null)
        return;
    RepositoryEntry courseRepoEntry = taskImpl.getTaskList().getEntry();
    AssessmentEntryStatus assessmentStatus = convertToAssessmentEntrystatus(taskImpl, cNode);
    if (GTAType.group.name().equals(cNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
        // update whole group
        assessmentService.updateAssessmentEntries(taskImpl.getBusinessGroup(), courseRepoEntry, cNode.getIdent(), null, assessmentStatus);
    } else {
        Identity assessedIdentity = taskImpl.getIdentity();
        assessmentService.updateAssessmentEntry(assessedIdentity, courseRepoEntry, cNode.getIdent(), null, assessmentStatus);
        dbInstance.commit();
        ICourse course = CourseFactory.loadCourse(courseRepoEntry);
        UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
        cNode.updateLastModifications(userCourseEnv, taskImpl.getIdentity(), by);
    }
}
Also used : UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus)

Example 5 with AssessmentEntryStatus

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

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)

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