use of org.olat.modules.coach.model.SearchCoachedIdentityParams in project OpenOLAT by OpenOLAT.
the class CoachingLargeTest method getUsersStatistics.
@Test
public void getUsersStatistics() {
SearchCoachedIdentityParams params = new SearchCoachedIdentityParams();
params.setLogin(aStudent.getName());
List<StudentStatEntry> statEntries = coachingService.getUsersStatistics(params, userPropertyHandlers);
Assert.assertNotNull(statEntries);
Assert.assertEquals(1, statEntries.size());
StudentStatEntry statEntry = statEntries.get(0);
Assert.assertEquals(aStudent.getKey(), statEntry.getIdentityKey());
Assert.assertEquals(studentToCourseMap.get(aStudent).size(), statEntry.getCountRepo());
}
use of org.olat.modules.coach.model.SearchCoachedIdentityParams in project openolat by klemens.
the class CoachingDAOTest method getUsers.
@Test
public void getUsers() throws URISyntaxException {
URL coachingCourseUrl = CoachingLargeTest.class.getResource("CoachingCourse.zip");
File coachingCourseFile = new File(coachingCourseUrl.toURI());
RepositoryEntry re1 = CourseFactory.deployCourseFromZIP(coachingCourseFile, UUID.randomUUID().toString(), 4);
RepositoryEntry re2 = CourseFactory.deployCourseFromZIP(coachingCourseFile, UUID.randomUUID().toString(), 4);
RepositoryEntry re3 = CourseFactory.deployCourseFromZIP(coachingCourseFile, UUID.randomUUID().toString(), 4);
dbInstance.commitAndCloseSession();
// members of courses
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("User-Part-1");
repositoryService.addRole(participant, re1, GroupRoles.participant.name());
repositoryService.addRole(participant, re2, GroupRoles.participant.name());
dbInstance.commitAndCloseSession();
// groups
BusinessGroup group2 = businessGroupService.createBusinessGroup(null, "Coaching-grp-1", "tg", null, null, false, false, re2);
businessGroupRelationDao.addRole(participant, group2, GroupRoles.participant.name());
BusinessGroup group3 = businessGroupService.createBusinessGroup(null, "Coaching-grp-1", "tg", null, null, false, false, re3);
businessGroupRelationDao.addRole(participant, group3, GroupRoles.participant.name());
dbInstance.commitAndCloseSession();
// make statements participant 1
effManager.createUserEfficiencyStatement(new Date(), 6.0f, true, participant, re1.getOlatResource());
effManager.createUserEfficiencyStatement(new Date(), 4.0f, false, participant, re2.getOlatResource());
effManager.createUserEfficiencyStatement(new Date(), 2.0f, false, participant, re3.getOlatResource());
dbInstance.commitAndCloseSession();
// make user infos
userCourseInformationsManager.updateUserCourseInformations(re1.getOlatResource(), participant);
userCourseInformationsManager.updateUserCourseInformations(re2.getOlatResource(), participant);
userCourseInformationsManager.updateUserCourseInformations(re3.getOlatResource(), participant);
dbInstance.commitAndCloseSession();
// update props
User partUser = participant.getUser();
partUser.setProperty(UserConstants.FIRSTNAME, "Rei");
partUser.setProperty(UserConstants.LASTNAME, "Ayanami");
partUser.setProperty(UserConstants.EMAIL, "rei.ayanami@openolat.com");
partUser = userManager.updateUser(partUser);
dbInstance.commitAndCloseSession();
List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(UserListController.usageIdentifyer, false);
// search by first name
SearchCoachedIdentityParams params = new SearchCoachedIdentityParams();
Map<String, String> props = new HashMap<>();
props.put(UserConstants.FIRSTNAME, "re");
params.setUserProperties(props);
List<StudentStatEntry> stats = coachingDAO.getUsersStatisticsNative(params, userPropertyHandlers);
Assert.assertNotNull(stats);
Assert.assertFalse(stats.isEmpty());
// check participant
StudentStatEntry entryStat = getStudentStatEntry(participant, stats);
Assert.assertNotNull(entryStat);
Assert.assertEquals(3, entryStat.getCountRepo());
Assert.assertEquals(3, entryStat.getInitialLaunch());
Assert.assertEquals(1, entryStat.getCountPassed());
Assert.assertEquals(2, entryStat.getCountFailed());
Assert.assertEquals(0, entryStat.getCountNotAttempted());
// search by user name
SearchCoachedIdentityParams loginParams = new SearchCoachedIdentityParams();
loginParams.setLogin(participant.getName());
List<StudentStatEntry> loginStats = coachingDAO.getUsersStatisticsNative(loginParams, userPropertyHandlers);
Assert.assertNotNull(loginStats);
Assert.assertEquals(1, loginStats.size());
// check participant
StudentStatEntry loginStat = loginStats.get(0);
Assert.assertNotNull(loginStat);
Assert.assertEquals(3, loginStat.getCountRepo());
Assert.assertEquals(3, loginStat.getInitialLaunch());
Assert.assertEquals(1, loginStat.getCountPassed());
Assert.assertEquals(2, loginStat.getCountFailed());
Assert.assertEquals(0, loginStat.getCountNotAttempted());
}
use of org.olat.modules.coach.model.SearchCoachedIdentityParams in project OpenOLAT by OpenOLAT.
the class CoachingDAOTest method getUsers.
@Test
public void getUsers() throws URISyntaxException {
URL coachingCourseUrl = CoachingLargeTest.class.getResource("CoachingCourse.zip");
File coachingCourseFile = new File(coachingCourseUrl.toURI());
RepositoryEntry re1 = CourseFactory.deployCourseFromZIP(coachingCourseFile, UUID.randomUUID().toString(), 4);
RepositoryEntry re2 = CourseFactory.deployCourseFromZIP(coachingCourseFile, UUID.randomUUID().toString(), 4);
RepositoryEntry re3 = CourseFactory.deployCourseFromZIP(coachingCourseFile, UUID.randomUUID().toString(), 4);
dbInstance.commitAndCloseSession();
// members of courses
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("User-Part-1");
repositoryService.addRole(participant, re1, GroupRoles.participant.name());
repositoryService.addRole(participant, re2, GroupRoles.participant.name());
dbInstance.commitAndCloseSession();
// groups
BusinessGroup group2 = businessGroupService.createBusinessGroup(null, "Coaching-grp-1", "tg", null, null, false, false, re2);
businessGroupRelationDao.addRole(participant, group2, GroupRoles.participant.name());
BusinessGroup group3 = businessGroupService.createBusinessGroup(null, "Coaching-grp-1", "tg", null, null, false, false, re3);
businessGroupRelationDao.addRole(participant, group3, GroupRoles.participant.name());
dbInstance.commitAndCloseSession();
// make statements participant 1
effManager.createUserEfficiencyStatement(new Date(), 6.0f, true, participant, re1.getOlatResource());
effManager.createUserEfficiencyStatement(new Date(), 4.0f, false, participant, re2.getOlatResource());
effManager.createUserEfficiencyStatement(new Date(), 2.0f, false, participant, re3.getOlatResource());
dbInstance.commitAndCloseSession();
// make user infos
userCourseInformationsManager.updateUserCourseInformations(re1.getOlatResource(), participant);
userCourseInformationsManager.updateUserCourseInformations(re2.getOlatResource(), participant);
userCourseInformationsManager.updateUserCourseInformations(re3.getOlatResource(), participant);
dbInstance.commitAndCloseSession();
// update props
User partUser = participant.getUser();
partUser.setProperty(UserConstants.FIRSTNAME, "Rei");
partUser.setProperty(UserConstants.LASTNAME, "Ayanami");
partUser.setProperty(UserConstants.EMAIL, "rei.ayanami@openolat.com");
partUser = userManager.updateUser(partUser);
dbInstance.commitAndCloseSession();
List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(UserListController.usageIdentifyer, false);
// search by first name
SearchCoachedIdentityParams params = new SearchCoachedIdentityParams();
Map<String, String> props = new HashMap<>();
props.put(UserConstants.FIRSTNAME, "re");
params.setUserProperties(props);
List<StudentStatEntry> stats = coachingDAO.getUsersStatisticsNative(params, userPropertyHandlers);
Assert.assertNotNull(stats);
Assert.assertFalse(stats.isEmpty());
// check participant
StudentStatEntry entryStat = getStudentStatEntry(participant, stats);
Assert.assertNotNull(entryStat);
Assert.assertEquals(3, entryStat.getCountRepo());
Assert.assertEquals(3, entryStat.getInitialLaunch());
Assert.assertEquals(1, entryStat.getCountPassed());
Assert.assertEquals(2, entryStat.getCountFailed());
Assert.assertEquals(0, entryStat.getCountNotAttempted());
// search by user name
SearchCoachedIdentityParams loginParams = new SearchCoachedIdentityParams();
loginParams.setLogin(participant.getName());
List<StudentStatEntry> loginStats = coachingDAO.getUsersStatisticsNative(loginParams, userPropertyHandlers);
Assert.assertNotNull(loginStats);
Assert.assertEquals(1, loginStats.size());
// check participant
StudentStatEntry loginStat = loginStats.get(0);
Assert.assertNotNull(loginStat);
Assert.assertEquals(3, loginStat.getCountRepo());
Assert.assertEquals(3, loginStat.getInitialLaunch());
Assert.assertEquals(1, loginStat.getCountPassed());
Assert.assertEquals(2, loginStat.getCountFailed());
Assert.assertEquals(0, loginStat.getCountNotAttempted());
}
use of org.olat.modules.coach.model.SearchCoachedIdentityParams in project OpenOLAT by OpenOLAT.
the class UserSearchController method doSearchByIdentityKey.
private void doSearchByIdentityKey(UserRequest ureq, Long identityKey) {
SearchCoachedIdentityParams params = new SearchCoachedIdentityParams();
params.setIdentityKey(identityKey);
userListCtrl = new UserListController(ureq, getWindowControl(), stackPanel);
userListCtrl.search(params);
if (userListCtrl.size() == 1) {
userListCtrl.selectUniqueStudent(ureq);
stackPanel.pushController("Result", userListCtrl);
} else {
stackPanel.pushController("Results", userListCtrl);
}
}
use of org.olat.modules.coach.model.SearchCoachedIdentityParams in project OpenOLAT by OpenOLAT.
the class UserSearchController method doSearch.
private void doSearch(UserRequest ureq) {
String login = searchForm.getLogin();
boolean onlyActive = searchForm.isOnlyActive();
Map<String, String> searchProps = searchForm.getSearchProperties();
SearchCoachedIdentityParams params = new SearchCoachedIdentityParams();
params.setLogin(login);
params.setUserProperties(searchProps);
if (onlyActive) {
params.setStatus(Identity.STATUS_VISIBLE_LIMIT);
}
userListCtrl = new UserListController(ureq, getWindowControl(), stackPanel);
userListCtrl.search(params);
listenTo(userListCtrl);
stackPanel.popUpToRootController(ureq);
stackPanel.pushController(translate("results"), userListCtrl);
}
Aggregations