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);
}
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();
}
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);
}
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);
}
}
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());
}
}
}
Aggregations