use of org.olat.course.assessment.model.SearchAssessedIdentityParams 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);
}
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(testEntry, null, testEntry, 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();
}
use of org.olat.course.assessment.model.SearchAssessedIdentityParams 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.course.assessment.model.SearchAssessedIdentityParams in project OpenOLAT by OpenOLAT.
the class AssessmentCourseStatisticsSmallController method updateStatistics.
public void updateStatistics() {
ICourse course = CourseFactory.loadCourse(courseEntry);
String rootNodeIdent = course.getRunStructure().getRootNode().getIdent();
SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(courseEntry, rootNodeIdent, null, assessmentCallback);
numOfAssessedIdentities = assessmentToolManager.getNumberOfAssessedIdentities(getIdentity(), params);
mainVC.contextPut("numOfAssessedIdentities", numOfAssessedIdentities);
memberStatistics = assessmentToolManager.getNumberOfParticipants(getIdentity(), params);
mainVC.contextPut("numOfParticipants", memberStatistics.getNumOfParticipants());
if (assessmentCallback.canAssessNonMembers()) {
mainVC.contextPut("numOfOtherUsers", memberStatistics.getNumOfOtherUsers());
}
AssessmentStatistics stats = assessmentToolManager.getStatistics(getIdentity(), params);
mainVC.contextPut("scoreAverage", AssessmentHelper.getRoundedScore(stats.getAverageScore()));
numOfPassed = stats.getCountPassed();
mainVC.contextPut("numOfPassed", numOfPassed);
int total = memberStatistics.getTotal();
int percentPassed = total == 0 ? 0 : Math.round(100.0f * (stats.getCountPassed() / total));
mainVC.contextPut("percentPassed", percentPassed);
numOfFailed = stats.getCountFailed();
mainVC.contextPut("numOfFailed", numOfFailed);
int percentFailed = total == 0 ? 0 : Math.round(100.0f * (stats.getCountFailed() / total));
mainVC.contextPut("percentFailed", percentFailed);
int numOfParticipantLaunches = memberStatistics.getNumOfParticipantsLoggedIn();
mainVC.contextPut("numOfParticipantLaunches", numOfParticipantLaunches);
if (assessmentCallback.canAssessNonMembers()) {
int numOfOtherUserLaunches = memberStatistics.getLoggedIn();
mainVC.contextPut("numOfOtherUserLaunches", numOfOtherUserLaunches);
}
}
use of org.olat.course.assessment.model.SearchAssessedIdentityParams in project openolat by klemens.
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();
}
}
Aggregations