use of org.olat.modules.coach.model.EfficiencyStatementEntry in project openolat by klemens.
the class CoachingServiceImpl method getGroup.
@Override
public List<EfficiencyStatementEntry> getGroup(BusinessGroup group, List<UserPropertyHandler> userPropertyHandlers, Locale locale) {
List<Identity> students = businessGroupService.getMembers(group, GroupRoles.participant.name());
List<RepositoryEntry> courses = businessGroupService.findRepositoryEntries(Collections.singletonList(group), 0, -1);
List<UserEfficiencyStatement> statements = efficiencyStatementManager.getUserEfficiencyStatementLight(courses);
Map<IdentityRepositoryEntryKey, UserEfficiencyStatement> identityToStatements = new HashMap<>();
for (UserEfficiencyStatement statement : statements) {
IdentityRepositoryEntryKey key = new IdentityRepositoryEntryKey(statement.getIdentity().getKey(), statement.getCourseRepoKey());
identityToStatements.put(key, statement);
}
List<EfficiencyStatementEntry> entries = new ArrayList<>(students.size() * courses.size());
for (RepositoryEntry course : courses) {
for (Identity student : students) {
IdentityRepositoryEntryKey key = new IdentityRepositoryEntryKey(student.getKey(), course.getKey());
UserEfficiencyStatement statement = identityToStatements.get(key);
entries.add(new EfficiencyStatementEntry(student, course, statement, userPropertyHandlers, locale));
}
}
return entries;
}
use of org.olat.modules.coach.model.EfficiencyStatementEntry in project openolat by klemens.
the class CourseController 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();
EfficiencyStatementEntry selectedRow = model.getObject(se.getIndex());
if ("select".equals(cmd)) {
doSelectDetails(ureq, selectedRow);
}
}
} else if (source == openCourse) {
doOpenCourse(ureq);
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.modules.coach.model.EfficiencyStatementEntry in project openolat by klemens.
the class CourseController method nextEntry.
private void nextEntry(UserRequest ureq) {
EfficiencyStatementEntry currentEntry = statementCtrl.getEntry();
int nextIndex = model.getObjects().indexOf(currentEntry) + 1;
if (nextIndex < 0 || nextIndex >= model.getRowCount()) {
nextIndex = 0;
}
EfficiencyStatementEntry nextEntry = model.getObject(nextIndex);
doSelectDetails(ureq, nextEntry);
}
use of org.olat.modules.coach.model.EfficiencyStatementEntry in project openolat by klemens.
the class CourseController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
ContextEntry ce = entries.get(0);
OLATResourceable ores = ce.getOLATResourceable();
if ("Identity".equals(ores.getResourceableTypeName())) {
Long identityKey = ores.getResourceableId();
for (EfficiencyStatementEntry entry : model.getObjects()) {
if (identityKey.equals(entry.getIdentityKey())) {
doSelectDetails(ureq, entry);
statementCtrl.activate(ureq, entries.subList(1, entries.size()), ce.getTransientState());
break;
}
}
}
}
use of org.olat.modules.coach.model.EfficiencyStatementEntry in project OpenOLAT by OpenOLAT.
the class CoachingLargeTest method getCourse.
@Test
public void getCourse() {
List<Long> coachedCourses = coachToCourseMap.get(coach10.getKey());
Assert.assertNotNull(coachedCourses);
List<EfficiencyStatementEntry> statEntries = coachingService.getCourse(coach10, course10, userPropertyHandlers, Locale.ENGLISH);
Assert.assertNotNull(statEntries);
Assert.assertFalse(statEntries.isEmpty());
Assert.assertTrue(coachedCourses.contains(course10.getKey()));
for (EfficiencyStatementEntry statEntry : statEntries) {
Assert.assertNotNull(statEntry.getCourse());
Assert.assertEquals(course10.getKey(), statEntry.getCourse().getKey());
}
}
Aggregations