Search in sources :

Example 11 with SearchAssessedIdentityParams

use of org.olat.course.assessment.model.SearchAssessedIdentityParams in project OpenOLAT by OpenOLAT.

the class AssessmentToReviewSmallController method loadModel.

private void loadModel() {
    SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(courseEntry, null, null, assessmentCallback);
    List<AssessmentEntry> entries = assessmentToolManager.getAssessmentEntries(getIdentity(), params, AssessmentEntryStatus.inReview);
    List<UserToReviewRow> rows = new ArrayList<>();
    Map<Long, UserToReviewRow> identityKeyToRow = new HashMap<>();
    for (AssessmentEntry entry : entries) {
        Identity assessedIdentity = entry.getIdentity();
        if (identityKeyToRow.containsKey(assessedIdentity.getKey())) {
            identityKeyToRow.get(assessedIdentity.getKey()).getSubIndents().add(entry.getSubIdent());
        } else {
            UserToReviewRow row = new UserToReviewRow(entry.getIdentity(), userPropertyHandlers, getLocale());
            row.getSubIndents().add(entry.getSubIdent());
            rows.add(row);
            identityKeyToRow.put(assessedIdentity.getKey(), row);
        }
    }
    usersTableModel.setObjects(rows);
    tableEl.reset();
}
Also used : HashMap(java.util.HashMap) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 12 with SearchAssessedIdentityParams

use of org.olat.course.assessment.model.SearchAssessedIdentityParams in project OpenOLAT by OpenOLAT.

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 SearchAssessedIdentityParams

use of org.olat.course.assessment.model.SearchAssessedIdentityParams in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method getOptions.

protected AssessmentToolOptions getOptions() {
    SearchAssessedIdentityParams params = getSearchParameters();
    AssessmentToolOptions options = new AssessmentToolOptions();
    options.setAdmin(assessmentCallback.isAdmin());
    if (group == null) {
        if (assessmentCallback.isAdmin()) {
            options.setNonMembers(params.isNonMembers());
        } else {
            List<Identity> assessedIdentities = assessmentToolManager.getAssessedIdentities(getIdentity(), params);
            options.setIdentities(assessedIdentities);
            fillAlternativeToAssessableIdentityList(options, params);
        }
    } else {
        options.setGroup(group);
    }
    return options;
}
Also used : SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) AssessmentToolOptions(org.olat.modules.assessment.AssessmentToolOptions) Identity(org.olat.core.id.Identity)

Example 14 with SearchAssessedIdentityParams

use of org.olat.course.assessment.model.SearchAssessedIdentityParams in project OpenOLAT by OpenOLAT.

the class AssessedBusinessGroupCourseNodeListController method loadModel.

protected void loadModel() {
    if (assessmentCallback.canAssessBusinessGoupMembers()) {
        RepositoryEntry testEntry = null;
        if (courseNode.needsReferenceToARepositoryEntry()) {
            testEntry = courseNode.getReferencedRepositoryEntry();
        }
        SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(courseEntry, courseNode.getIdent(), testEntry, assessmentCallback);
        if (assessmentCallback.getCoachedGroups() != null) {
            List<Long> groupKeys = assessmentCallback.getCoachedGroups().stream().map(c -> c.getKey()).collect(Collectors.toList());
            params.setBusinessGroupKeys(groupKeys);
        }
        List<AssessedBusinessGroup> rows = assessmentToolManager.getBusinessGroupStatistics(getIdentity(), params);
        Set<Long> keys = rows.stream().map(c -> c.getKey()).collect(Collectors.toSet());
        List<BusinessGroup> groups;
        if (assessmentCallback.isAdmin()) {
            CourseEnvironment courseEnv = CourseFactory.loadCourse(courseEntry).getCourseEnvironment();
            groups = courseEnv.getCourseGroupManager().getAllBusinessGroups();
        } else if (assessmentCallback.getCoachedGroups() != null) {
            groups = assessmentCallback.getCoachedGroups();
        } else {
            groups = Collections.emptyList();
        }
        for (BusinessGroup group : groups) {
            if (!keys.contains(group.getKey())) {
                rows.add(new AssessedBusinessGroup(group.getKey(), group.getName(), 0.0d, 0, 0, 0, 0));
            }
        }
        tableModel.setObjects(rows);
        tableEl.reset();
        tableEl.reloadData();
    }
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) Util(org.olat.core.util.Util) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) AssessmentToolManager(org.olat.course.assessment.AssessmentToolManager) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) CourseFactory(org.olat.course.CourseFactory) CourseNode(org.olat.course.nodes.CourseNode) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentToolSecurityCallback(org.olat.modules.assessment.ui.AssessmentToolSecurityCallback) FormItem(org.olat.core.gui.components.form.flexible.FormItem) CourseNodeFactory(org.olat.course.nodes.CourseNodeFactory) Event(org.olat.core.gui.control.Event) OLATResourceable(org.olat.core.id.OLATResourceable) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) ContextEntry(org.olat.core.id.context.ContextEntry) OresHelper(org.olat.core.util.resource.OresHelper) SortKey(org.olat.core.commons.persistence.SortKey) ScoreCellRenderer(org.olat.modules.assessment.ui.ScoreCellRenderer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) StateEntry(org.olat.core.id.context.StateEntry) ABGCols(org.olat.course.assessment.ui.tool.AssessedBusinessGroupTableModel.ABGCols) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) BusinessGroupService(org.olat.group.BusinessGroupService) AssessmentModule(org.olat.course.assessment.AssessmentModule) ProgressRenderer(org.olat.modules.coach.ui.ProgressRenderer) CourseNodeEvent(org.olat.course.assessment.ui.tool.event.CourseNodeEvent) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) WindowControl(org.olat.core.gui.control.WindowControl) Set(java.util.Set) Collectors(java.util.stream.Collectors) Controller(org.olat.core.gui.control.Controller) BusinessControlFactory(org.olat.core.id.context.BusinessControlFactory) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) List(java.util.List) AssessmentToolContainer(org.olat.modules.assessment.ui.AssessmentToolContainer) BusinessGroup(org.olat.group.BusinessGroup) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) UserRequest(org.olat.core.gui.UserRequest) Collections(java.util.Collections) AssessedBusinessGroup(org.olat.course.assessment.model.AssessedBusinessGroup) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) BusinessGroup(org.olat.group.BusinessGroup) AssessedBusinessGroup(org.olat.course.assessment.model.AssessedBusinessGroup) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) AssessedBusinessGroup(org.olat.course.assessment.model.AssessedBusinessGroup) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 15 with SearchAssessedIdentityParams

use of org.olat.course.assessment.model.SearchAssessedIdentityParams in project OpenOLAT by OpenOLAT.

the class AssessedIdentityListProvider method getResult.

@Override
public void getResult(String searchValue, ListReceiver receiver) {
    SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(courseEntry, subIdent, referenceEntry, assessmentCallback);
    params.setSearchString(searchValue);
    int maxEntries = MAX_ENTRIES;
    List<IdentityShort> res = assessmentToolManager.getShortAssessedIdentities(coach, params, maxEntries);
    boolean hasMore = false;
    for (Iterator<IdentityShort> it_res = res.iterator(); (hasMore = it_res.hasNext()) && maxEntries > 0; ) {
        maxEntries--;
        IdentityShort ident = it_res.next();
        String key = ident.getKey().toString();
        String displayKey = ident.getName();
        String displayText = userManager.getUserDisplayName(ident);
        receiver.addEntry(key, displayKey, displayText, CSSHelper.CSS_CLASS_USER);
    }
    if (hasMore) {
        receiver.addEntry(".....", ".....");
    }
}
Also used : IdentityShort(org.olat.basesecurity.IdentityShort) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams)

Aggregations

SearchAssessedIdentityParams (org.olat.course.assessment.model.SearchAssessedIdentityParams)22 Identity (org.olat.core.id.Identity)12 ArrayList (java.util.ArrayList)10 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)10 HashMap (java.util.HashMap)8 BusinessGroup (org.olat.group.BusinessGroup)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 Collections (java.util.Collections)6 List (java.util.List)6 UserRequest (org.olat.core.gui.UserRequest)6 FormItem (org.olat.core.gui.components.form.flexible.FormItem)6 FormItemContainer (org.olat.core.gui.components.form.flexible.FormItemContainer)6 FlexiTableElement (org.olat.core.gui.components.form.flexible.elements.FlexiTableElement)6 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)6 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)6 FormEvent (org.olat.core.gui.components.form.flexible.impl.FormEvent)6 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)6 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)6 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)6 FlexiTableDataModelFactory (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory)6