use of org.olat.course.assessment.AssessmentMode in project openolat by klemens.
the class AssessmentModeListModel method updateModeStatus.
public boolean updateModeStatus(TransientAssessmentMode modeToUpdate) {
boolean updated = false;
List<AssessmentMode> modes = getObjects();
for (AssessmentMode mode : modes) {
if (mode.getKey().equals(modeToUpdate.getModeKey())) {
if (mode.getStatus() != modeToUpdate.getStatus()) {
mode.setStatus(modeToUpdate.getStatus());
updated = true;
}
}
}
return updated;
}
use of org.olat.course.assessment.AssessmentMode in project openolat by klemens.
the class AssessmentModeManagerTest method loadAssessmentMode_identityInBusinessGroup_coach.
/**
* Check an assessment linked to a group with one participant
*/
@Test
public void loadAssessmentMode_identityInBusinessGroup_coach() {
Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("as-mode-4");
RepositoryEntry entry = JunitTestHelper.deployBasicCourse(author);
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("as-mode-5");
Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("as-mode-6");
BusinessGroup businessGroup = businessGroupService.createBusinessGroup(null, "as-mode-3", "", null, null, null, null, false, false, entry);
businessGroupRelationDao.addRole(participant, businessGroup, GroupRoles.participant.name());
businessGroupRelationDao.addRole(coach, businessGroup, GroupRoles.coach.name());
AssessmentMode mode = createMinimalAssessmentmode(entry);
mode.setTargetAudience(AssessmentMode.Target.courseAndGroups);
mode.setApplySettingsForCoach(true);
mode = assessmentModeMgr.persist(mode);
AssessmentModeToGroup modeToGroup = assessmentModeMgr.createAssessmentModeToGroup(mode, businessGroup);
mode.getGroups().add(modeToGroup);
mode = assessmentModeMgr.merge(mode, true);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(mode);
// check participant
List<AssessmentMode> currentModes = assessmentModeMgr.getAssessmentModeFor(participant);
Assert.assertNotNull(currentModes);
Assert.assertEquals(1, currentModes.size());
Assert.assertTrue(currentModes.contains(mode));
// check coach
List<AssessmentMode> currentCoachModes = assessmentModeMgr.getAssessmentModeFor(coach);
Assert.assertNotNull(currentCoachModes);
Assert.assertEquals(1, currentCoachModes.size());
Assert.assertTrue(currentCoachModes.contains(mode));
// check author
List<AssessmentMode> currentAuthorModes = assessmentModeMgr.getAssessmentModeFor(author);
Assert.assertNotNull(currentAuthorModes);
Assert.assertTrue(currentAuthorModes.isEmpty());
}
use of org.olat.course.assessment.AssessmentMode in project openolat by klemens.
the class AssessmentModeManagerTest method loadAssessmentMode_identityInArea_coach.
/**
* Check an assessment linked to an area with one participant
*/
@Test
public void loadAssessmentMode_identityInArea_coach() {
Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("as-mode-12");
RepositoryEntry entry = JunitTestHelper.deployBasicCourse(author);
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("as-mode-13");
Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("as-mode-14");
BusinessGroup businessGroup = businessGroupService.createBusinessGroup(null, "as-mode-3", "", null, null, null, null, false, false, entry);
businessGroupRelationDao.addRole(participant, businessGroup, GroupRoles.participant.name());
businessGroupRelationDao.addRole(coach, businessGroup, GroupRoles.coach.name());
BGArea area = areaMgr.createAndPersistBGArea("area for people", "", entry.getOlatResource());
areaMgr.addBGToBGArea(businessGroup, area);
AssessmentMode mode = createMinimalAssessmentmode(entry);
mode.setTargetAudience(AssessmentMode.Target.courseAndGroups);
mode.setApplySettingsForCoach(true);
mode = assessmentModeMgr.persist(mode);
AssessmentModeToArea modeToArea = assessmentModeMgr.createAssessmentModeToArea(mode, area);
mode.getAreas().add(modeToArea);
mode = assessmentModeMgr.merge(mode, true);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(mode);
// check participant
List<AssessmentMode> currentModes = assessmentModeMgr.getAssessmentModeFor(participant);
Assert.assertNotNull(currentModes);
Assert.assertEquals(1, currentModes.size());
Assert.assertTrue(currentModes.contains(mode));
// check coach
List<AssessmentMode> currentCoachModes = assessmentModeMgr.getAssessmentModeFor(coach);
Assert.assertNotNull(currentCoachModes);
Assert.assertEquals(1, currentCoachModes.size());
Assert.assertTrue(currentCoachModes.contains(mode));
// check author
List<AssessmentMode> currentAuthorModes = assessmentModeMgr.getAssessmentModeFor(author);
Assert.assertNotNull(currentAuthorModes);
Assert.assertTrue(currentAuthorModes.isEmpty());
}
use of org.olat.course.assessment.AssessmentMode in project openolat by klemens.
the class AssessmentModeManagerTest method loadAssessmentMode_identityInArea.
/**
* Check an assessment linked to an area with one participant
*/
@Test
public void loadAssessmentMode_identityInArea() {
Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("as-mode-12");
RepositoryEntry entry = JunitTestHelper.deployBasicCourse(author);
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("as-mode-13");
Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("as-mode-14");
BusinessGroup businessGroup = businessGroupService.createBusinessGroup(author, "as-mode-3", "", null, null, null, null, false, false, entry);
businessGroupRelationDao.addRole(participant, businessGroup, GroupRoles.participant.name());
businessGroupRelationDao.addRole(coach, businessGroup, GroupRoles.coach.name());
BGArea area = areaMgr.createAndPersistBGArea("area for people", "", entry.getOlatResource());
areaMgr.addBGToBGArea(businessGroup, area);
AssessmentMode mode = createMinimalAssessmentmode(entry);
mode.setTargetAudience(AssessmentMode.Target.courseAndGroups);
mode.setApplySettingsForCoach(false);
mode = assessmentModeMgr.persist(mode);
AssessmentModeToGroup modeToGroup = assessmentModeMgr.createAssessmentModeToGroup(mode, businessGroup);
mode.getGroups().add(modeToGroup);
mode = assessmentModeMgr.merge(mode, true);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(mode);
// check participant
List<AssessmentMode> currentModes = assessmentModeMgr.getAssessmentModeFor(participant);
Assert.assertNotNull(currentModes);
Assert.assertEquals(1, currentModes.size());
Assert.assertTrue(currentModes.contains(mode));
// check coach
List<AssessmentMode> currentCoachModes = assessmentModeMgr.getAssessmentModeFor(coach);
Assert.assertNotNull(currentCoachModes);
Assert.assertTrue(currentCoachModes.isEmpty());
// check author
List<AssessmentMode> currentAuthorModes = assessmentModeMgr.getAssessmentModeFor(author);
Assert.assertNotNull(currentAuthorModes);
Assert.assertTrue(currentAuthorModes.isEmpty());
}
use of org.olat.course.assessment.AssessmentMode in project openolat by klemens.
the class AssessmentModeManagerTest method getCurrentAssessmentMode.
@Test
public void getCurrentAssessmentMode() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
AssessmentMode mode = createMinimalAssessmentmode(entry);
mode = assessmentModeMgr.persist(mode);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(mode);
// check
Date now = new Date();
List<AssessmentMode> currentModes = assessmentModeMgr.getCurrentAssessmentMode(entry, now);
Assert.assertNotNull(currentModes);
Assert.assertEquals(1, currentModes.size());
Assert.assertTrue(currentModes.contains(mode));
}
Aggregations