Search in sources :

Example 1 with AssessedIdentityElementRow

use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method doSetVisibility.

private void doSetVisibility(UserRequest ureq, Boolean visibility, List<AssessedIdentityElementRow> rows) {
    ICourse course = CourseFactory.loadCourse(courseEntry);
    AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
    for (AssessedIdentityElementRow row : rows) {
        Identity assessedIdentity = securityManager.loadIdentityByKey(row.getIdentityKey());
        Roles roles = securityManager.getRoles(assessedIdentity);
        IdentityEnvironment identityEnv = new IdentityEnvironment(assessedIdentity, roles);
        UserCourseEnvironment assessedUserCourseEnv = new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment(), coachCourseEnv.isCourseReadOnly());
        assessedUserCourseEnv.getScoreAccounting().evaluateAll();
        ScoreEvaluation scoreEval = assessableCourseNode.getUserScoreEvaluation(assessedUserCourseEnv);
        ScoreEvaluation doneEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), scoreEval.getAssessmentStatus(), visibility, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID());
        assessableCourseNode.updateUserScoreEvaluation(doneEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
    }
    loadModel(ureq);
}
Also used : CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ICourse(org.olat.course.ICourse) Roles(org.olat.core.id.Roles) Identity(org.olat.core.id.Identity) IdentityEnvironment(org.olat.core.id.IdentityEnvironment)

Example 2 with AssessedIdentityElementRow

use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method loadModel.

protected void loadModel(@SuppressWarnings("unused") UserRequest ureq) {
    SearchAssessedIdentityParams params = getSearchParameters();
    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));
    List<AssessedIdentityElementRow> rows = new ArrayList<>(assessedIdentities.size());
    for (Identity assessedIdentity : assessedIdentities) {
        AssessmentEntry entry = entryMap.get(assessedIdentity.getKey());
        CompletionItem currentCompletion = new CompletionItem("current-completion-" + (++counter), getLocale());
        if (entry != null) {
            currentCompletion.setCompletion(entry.getCurrentRunCompletion());
            AssessmentRunStatus status = entry.getCurrentRunStatus();
            currentCompletion.setEnded(status != null && AssessmentRunStatus.done.equals(status));
        }
        FormLink toolsLink = uifactory.addFormLink("tools_" + (++counter), "tools", "", null, null, Link.NONTRANSLATED);
        toolsLink.setIconLeftCSS("o_icon o_icon_actions o_icon-lg");
        AssessedIdentityElementRow row = new AssessedIdentityElementRow(assessedIdentity, entry, currentCompletion, toolsLink, userPropertyHandlers, getLocale());
        toolsLink.setUserObject(row);
        rows.add(row);
    }
    usersTableModel.setObjects(rows);
    List<FlexiTableFilter> filters = tableEl.getSelectedFilters();
    if (filters != null && filters.size() > 0 && filters.get(0) != null) {
        usersTableModel.filter(Collections.singletonList(filters.get(0)));
    }
    tableEl.reset();
    tableEl.reloadData();
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) Util(org.olat.core.util.Util) IdentityEnvironment(org.olat.core.id.IdentityEnvironment) RepositoryService(org.olat.repository.RepositoryService) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) AssessmentToolManager(org.olat.course.assessment.AssessmentToolManager) Role(org.olat.modules.assessment.Role) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) CourseNode(org.olat.course.nodes.CourseNode) IdentityRef(org.olat.basesecurity.IdentityRef) AssessmentToolSecurityCallback(org.olat.modules.assessment.ui.AssessmentToolSecurityCallback) CourseNodeFactory(org.olat.course.nodes.CourseNodeFactory) OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentToolOptions(org.olat.modules.assessment.AssessmentToolOptions) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) GenericEventListener(org.olat.core.util.event.GenericEventListener) OresHelper(org.olat.core.util.resource.OresHelper) Map(java.util.Map) SortKey(org.olat.core.commons.persistence.SortKey) Group(org.olat.basesecurity.Group) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ICourse(org.olat.course.ICourse) IdentityCourseElementCols(org.olat.course.assessment.ui.tool.IdentityListCourseNodeTableModel.IdentityCourseElementCols) AssessmentModule(org.olat.course.assessment.AssessmentModule) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) WindowControl(org.olat.core.gui.control.WindowControl) STCourseNode(org.olat.course.nodes.STCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentFormEvent(org.olat.modules.assessment.ui.event.AssessmentFormEvent) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) Set(java.util.Set) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) Component(org.olat.core.gui.components.Component) LinkFactory(org.olat.core.gui.components.link.LinkFactory) AssessedIdentityListState(org.olat.modules.assessment.ui.AssessedIdentityListState) AssessedIdentityController(org.olat.modules.assessment.ui.AssessedIdentityController) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) List(java.util.List) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) Align(org.olat.core.gui.components.stack.TooledStackedPanel.Align) Identity(org.olat.core.id.Identity) AssessmentRunStatus(org.olat.modules.assessment.model.AssessmentRunStatus) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) BaseSecurity(org.olat.basesecurity.BaseSecurity) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) Roles(org.olat.core.id.Roles) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) HashMap(java.util.HashMap) CourseFactory(org.olat.course.CourseFactory) RepositoryEntry(org.olat.repository.RepositoryEntry) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) CompletionItem(org.olat.modules.assessment.ui.component.CompletionItem) 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) ScoreCellRenderer(org.olat.modules.assessment.ui.ScoreCellRenderer) 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) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) Link(org.olat.core.gui.components.link.Link) CompletionEvent(org.olat.modules.assessment.ui.event.CompletionEvent) ShowDetailsEvent(org.olat.course.assessment.ui.tool.event.ShowDetailsEvent) IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) Controller(org.olat.core.gui.control.Controller) UserManager(org.olat.user.UserManager) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) AssessmentToolContainer(org.olat.modules.assessment.ui.AssessmentToolContainer) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) 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) CoordinatorManager(org.olat.core.util.coordinate.CoordinatorManager) AssessmentRunStatus(org.olat.modules.assessment.model.AssessmentRunStatus) HashMap(java.util.HashMap) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ArrayList(java.util.ArrayList) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) CompletionItem(org.olat.modules.assessment.ui.component.CompletionItem) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) Identity(org.olat.core.id.Identity)

Example 3 with AssessedIdentityElementRow

use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            AssessedIdentityElementRow row = usersTableModel.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                doSelect(ureq, row);
            }
        } else if (event instanceof FlexiTableSearchEvent) {
            loadModel(ureq);
        }
    } else if (bulkDoneButton == source) {
        doSetDone(ureq);
    } else if (bulkVisibleButton == source) {
        doConfirmVisible(ureq);
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        if ("tools".equals(link.getCmd())) {
            doOpenTools(ureq, (AssessedIdentityElementRow) link.getUserObject(), link);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 4 with AssessedIdentityElementRow

use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeTableModel method filter.

@Override
public void filter(List<FlexiTableFilter> filters) {
    String key = filters == null || filters.isEmpty() || filters.get(0) == null ? null : filters.get(0).getFilter();
    if (StringHelper.containsNonWhitespace(key)) {
        List<AssessedIdentityElementRow> filteredRows = new ArrayList<>();
        if ("passed".equals(key)) {
            for (AssessedIdentityElementRow row : backups) {
                if (row.getPassed() != null && row.getPassed().booleanValue()) {
                    filteredRows.add(row);
                }
            }
        } else if ("failed".equals(key)) {
            for (AssessedIdentityElementRow row : backups) {
                if (row.getPassed() != null && !row.getPassed().booleanValue()) {
                    filteredRows.add(row);
                }
            }
        } else if (AssessmentEntryStatus.isValueOf(key)) {
            for (AssessedIdentityElementRow row : backups) {
                if (row.getAssessmentStatus() != null && key.equals(row.getAssessmentStatus().name())) {
                    filteredRows.add(row);
                }
            }
        } else {
            filteredRows.addAll(backups);
        }
        super.setObjects(filteredRows);
    } else {
        super.setObjects(backups);
    }
}
Also used : AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ArrayList(java.util.ArrayList)

Example 5 with AssessedIdentityElementRow

use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project OpenOLAT by OpenOLAT.

the class GTAIdentityListCourseNodeController method loadTasksInModel.

private void loadTasksInModel(TaskList taskList) {
    List<Task> tasks = gtaManager.getTasks(taskList, (GTACourseNode) courseNode);
    Map<Long, Task> identityToTask = new HashMap<>();
    for (Task task : tasks) {
        if (task.getIdentity() != null) {
            identityToTask.put(task.getIdentity().getKey(), task);
        }
    }
    List<AssessedIdentityElementRow> rows = usersTableModel.getObjects();
    for (AssessedIdentityElementRow row : rows) {
        Task task = identityToTask.get(row.getIdentityKey());
        if (task != null && StringHelper.containsNonWhitespace(task.getTaskName())) {
            row.setDetails(task.getTaskName());
        }
    }
}
Also used : Task(org.olat.course.nodes.gta.Task) HashMap(java.util.HashMap) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow)

Aggregations

AssessedIdentityElementRow (org.olat.modules.assessment.ui.AssessedIdentityElementRow)22 ArrayList (java.util.ArrayList)10 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)6 Identity (org.olat.core.id.Identity)6 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)6 Roles (org.olat.core.id.Roles)6 ICourse (org.olat.course.ICourse)6 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)6 CalculatedAssessableCourseNode (org.olat.course.nodes.CalculatedAssessableCourseNode)6 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)6 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)6 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)6 HashMap (java.util.HashMap)4 IdentityRef (org.olat.basesecurity.IdentityRef)4 IdentityRefImpl (org.olat.basesecurity.model.IdentityRefImpl)4 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)4 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)4 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)4 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)4 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)4