use of org.olat.modules.assessment.AssessmentEntry 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.modules.assessment.AssessmentEntry 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.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class CheckListRunController method exposeUserDataToVC.
private void exposeUserDataToVC(UserRequest ureq, FormLayoutContainer layoutCont) {
AssessmentEntry scoreEval = courseNode.getUserAssessmentEntry(userCourseEnv);
if (scoreEval == null) {
layoutCont.contextPut("score", null);
layoutCont.contextPut("hasPassedValue", Boolean.FALSE);
layoutCont.contextPut("passed", null);
layoutCont.contextPut("comment", null);
layoutCont.contextPut("docs", null);
} else {
boolean resultsVisible = scoreEval.getUserVisibility() == null || scoreEval.getUserVisibility().booleanValue();
layoutCont.contextPut("resultsVisible", resultsVisible);
layoutCont.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
layoutCont.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
layoutCont.contextPut("passed", scoreEval.getPassed());
if (resultsVisible) {
if (courseNode.hasCommentConfigured()) {
StringBuilder comment = Formatter.stripTabsAndReturns(scoreEval.getComment());
layoutCont.contextPut("comment", StringHelper.xssScan(comment));
layoutCont.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
if (courseNode.hasIndividualAsssessmentDocuments()) {
List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
layoutCont.contextPut("docsMapperUri", mapperUri);
layoutCont.contextPut("docs", docs);
layoutCont.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
}
} else {
layoutCont.contextPut("comment", null);
layoutCont.contextPut("docs", null);
}
}
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
layoutCont.contextPut("log", am.getUserNodeLog(courseNode, userCourseEnv.getIdentityEnvironment().getIdentity()));
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class GroupAssessmentController method loadModel.
/**
* @return True if all results are the same
*/
private ModelInfos loadModel() {
// load participants, load datas
ICourse course = CourseFactory.loadCourse(courseEntry);
List<Identity> identities = businessGroupService.getMembers(assessedGroup, GroupRoles.participant.name());
Map<Identity, AssessmentEntry> identityToEntryMap = new HashMap<>();
List<AssessmentEntry> entries = course.getCourseEnvironment().getAssessmentManager().getAssessmentEntries(assessedGroup, gtaNode);
for (AssessmentEntry entry : entries) {
identityToEntryMap.put(entry.getIdentity(), entry);
}
int count = 0;
boolean same = true;
StringBuilder duplicateWarning = new StringBuilder();
Float scoreRef = null;
Boolean passedRef = null;
String commentRef = null;
Boolean userVisibleRef = null;
List<AssessmentRow> rows = new ArrayList<>(identities.size());
for (Identity identity : identities) {
AssessmentEntry entry = identityToEntryMap.get(identity);
ScoreEvaluation scoreEval = null;
if (withScore || withPassed) {
scoreEval = gtaNode.getUserScoreEvaluation(entry);
if (scoreEval == null) {
scoreEval = ScoreEvaluation.EMPTY_EVALUATION;
}
}
String comment = null;
if (withComment && entry != null) {
comment = entry.getComment();
}
boolean duplicate = duplicateMemberKeys.contains(identity.getKey());
if (duplicate) {
if (duplicateWarning.length() > 0)
duplicateWarning.append(", ");
duplicateWarning.append(StringHelper.escapeHtml(userManager.getUserDisplayName(identity)));
}
AssessmentRow row = new AssessmentRow(identity, duplicate);
rows.add(row);
if (withScore) {
Float score = scoreEval.getScore();
String pointVal = AssessmentHelper.getRoundedScore(score);
TextElement pointEl = uifactory.addTextElement("point" + count, null, 5, pointVal, flc);
pointEl.setDisplaySize(5);
row.setScoreEl(pointEl);
if (count == 0) {
scoreRef = score;
} else if (!same(scoreRef, score)) {
same = false;
}
}
if (withPassed && cutValue == null) {
Boolean passed = scoreEval.getPassed();
MultipleSelectionElement passedEl = uifactory.addCheckboxesHorizontal("check" + count, null, flc, onKeys, onValues);
if (passed != null && passed.booleanValue()) {
passedEl.select(onKeys[0], passed.booleanValue());
}
row.setPassedEl(passedEl);
if (count == 0) {
passedRef = passed;
} else if (!same(passedRef, passed)) {
same = false;
}
}
if (withComment) {
FormLink commentLink = uifactory.addFormLink("comment-" + CodeHelper.getRAMUniqueID(), "comment", "comment", null, flc, Link.LINK);
if (StringHelper.containsNonWhitespace(comment)) {
commentLink.setIconLeftCSS("o_icon o_icon_comments");
} else {
commentLink.setIconLeftCSS("o_icon o_icon_comments_none");
}
commentLink.setUserObject(row);
row.setComment(comment);
row.setCommentEditLink(commentLink);
if (count == 0) {
commentRef = comment;
} else if (!same(commentRef, comment)) {
same = false;
}
}
if (withScore || withPassed || withPassed) {
Boolean userVisible = scoreEval.getUserVisible();
if (userVisible == null) {
userVisible = Boolean.TRUE;
}
if (count == 0) {
userVisibleRef = userVisible;
} else if (!same(userVisibleRef, userVisible)) {
same = false;
}
}
count++;
}
model.setObjects(rows);
table.reset();
return new ModelInfos(same, scoreRef, passedRef, commentRef, userVisibleRef, duplicateWarning.toString());
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class MSCourseNodeRunController method exposeUserDataToVC.
private void exposeUserDataToVC(UserRequest ureq) {
AssessmentEntry assessmentEntry = courseNode.getUserAssessmentEntry(userCourseEnv);
if (assessmentEntry == null) {
myContent.contextPut("hasPassedValue", Boolean.FALSE);
myContent.contextPut("passed", Boolean.FALSE);
hasPassed = hasScore = hasComment = false;
} else {
String rawComment = assessmentEntry.getComment();
hasPassed = assessmentEntry.getPassed() != null;
hasScore = assessmentEntry.getScore() != null;
hasComment = courseNode.hasCommentConfigured() && StringHelper.containsNonWhitespace(rawComment);
boolean resultsVisible = overrideUserResultsVisiblity || assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
myContent.contextPut("resultsVisible", resultsVisible);
myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
myContent.contextPut("hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
myContent.contextPut("passed", assessmentEntry.getPassed());
if (resultsVisible) {
if (hasComment) {
StringBuilder comment = Formatter.stripTabsAndReturns(rawComment);
myContent.contextPut("comment", StringHelper.xssScan(comment));
myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
if (courseNode.hasIndividualAsssessmentDocuments()) {
List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
myContent.contextPut("docsMapperUri", mapperUri);
myContent.contextPut("docs", docs);
myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
if (download == null) {
download = new DisplayOrDownloadComponent("", null);
myContent.put("download", download);
}
}
}
}
if (showLog) {
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
myContent.contextPut("log", am.getUserNodeLog(courseNode, userCourseEnv.getIdentityEnvironment().getIdentity()));
}
}
Aggregations