use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project OpenOLAT by OpenOLAT.
the class IdentityListCourseNodeController method getSelectedIdentities.
@Override
public List<IdentityRef> getSelectedIdentities() {
Set<Integer> selections = tableEl.getMultiSelectedIndex();
List<AssessedIdentityElementRow> rows = new ArrayList<>(selections.size());
for (Integer i : selections) {
AssessedIdentityElementRow row = usersTableModel.getObject(i.intValue());
if (row != null && row.getAssessmentStatus() != AssessmentEntryStatus.done) {
rows.add(row);
}
}
if (rows == null || rows.isEmpty()) {
return Collections.emptyList();
}
List<IdentityRef> selectedIdentities = new ArrayList<>();
for (AssessedIdentityElementRow row : rows) {
selectedIdentities.add(new IdentityRefImpl(row.getIdentityKey()));
}
return selectedIdentities;
}
use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project OpenOLAT by OpenOLAT.
the class IdentityListCourseNodeController method doSetDone.
private void doSetDone(UserRequest ureq) {
Set<Integer> selections = tableEl.getMultiSelectedIndex();
List<AssessedIdentityElementRow> rows = new ArrayList<>(selections.size());
for (Integer i : selections) {
AssessedIdentityElementRow row = usersTableModel.getObject(i.intValue());
if (row != null && row.getAssessmentStatus() != AssessmentEntryStatus.done) {
rows.add(row);
}
}
if (rows == null || rows.isEmpty()) {
showWarning("warning.bulk.done");
} else if (courseNode instanceof AssessableCourseNode) {
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(), AssessmentEntryStatus.done, null, 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 STIdentityListCourseNodeController method loadModel.
@Override
protected void loadModel(UserRequest ureq) {
Map<Long, Date> initialLaunchDates = userInfosMgr.getInitialLaunchDates(getCourseRepositoryEntry().getOlatResource());
super.loadModel(ureq);
List<AssessedIdentityElementRow> rows = usersTableModel.getObjects();
for (AssessedIdentityElementRow row : rows) {
Date initialLaunchDate = initialLaunchDates.get(row.getIdentityKey());
row.setInitialCourseLaunchDate(initialLaunchDate);
}
AssessmentToolContainer toolContainer = getToolContainer();
if (toolContainer.getCertificateMap() == null) {
List<CertificateLight> certificates = certificatesManager.getLastCertificates(getCourseRepositoryEntry().getOlatResource());
ConcurrentMap<Long, CertificateLight> certificateMap = new ConcurrentHashMap<>();
for (CertificateLight certificate : certificates) {
certificateMap.put(certificate.getIdentityKey(), certificate);
}
toolContainer.setCertificateMap(certificateMap);
}
usersTableModel.setCertificateMap(toolContainer.getCertificateMap());
}
use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project openolat by klemens.
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 klemens.
the class IdentityListCourseNodeController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
String filter = null;
List<FlexiTableFilter> extendedFilters = null;
if (state instanceof AssessedIdentityListState) {
AssessedIdentityListState listState = (AssessedIdentityListState) state;
if (StringHelper.containsNonWhitespace(listState.getFilter())) {
filter = listState.getFilter();
}
extendedFilters = listState.getExtendedFilters();
}
tableEl.setSelectedFilterKey(filter);
if (extendedFilters != null) {
tableEl.setSelectedExtendedFilters(extendedFilters);
}
loadModel(ureq);
if (entries != null && entries.size() > 0) {
ContextEntry entry = entries.get(0);
String resourceType = entry.getOLATResourceable().getResourceableTypeName();
if ("Identity".equals(resourceType)) {
Long identityKey = entries.get(0).getOLATResourceable().getResourceableId();
for (int i = usersTableModel.getRowCount(); i-- > 0; ) {
AssessedIdentityElementRow row = usersTableModel.getObject(i);
if (row.getIdentityKey().equals(identityKey)) {
Controller ctrl = doSelect(ureq, row);
if (ctrl instanceof Activateable2) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
((Activateable2) ctrl).activate(ureq, subEntries, entry.getTransientState());
}
}
}
}
}
}
Aggregations