use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class RepositoryEntryLectureConfigurationDAOTest method deleteConfiguration_byRepositoryEntry.
@Test
public void deleteConfiguration_byRepositoryEntry() {
// create a configuration
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
RepositoryEntryLectureConfiguration config = lectureConfigurationDao.createConfiguration(entry);
config.setLectureEnabled(true);
RepositoryEntryLectureConfiguration mergedConfig = lectureConfigurationDao.update(config);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(mergedConfig);
// delete the configuration
lectureConfigurationDao.deleteConfiguration(entry);
dbInstance.commitAndCloseSession();
// check that the configuration is really deleted
RepositoryEntryLectureConfiguration deletedConfig = lectureConfigurationDao.getConfiguration(entry);
Assert.assertNull(deletedConfig);
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class RepositoryEntryLectureConfigurationDAOTest method createLectureConfiguration.
@Test
public void createLectureConfiguration() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
RepositoryEntryLectureConfiguration config = lectureConfigurationDao.createConfiguration(entry);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(config);
Assert.assertNotNull(config.getKey());
Assert.assertNotNull(config.getCreationDate());
Assert.assertNotNull(config.getLastModified());
Assert.assertEquals(entry, config.getEntry());
Assert.assertFalse(config.isLectureEnabled());
Assert.assertFalse(config.isOverrideModuleDefault());
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class LectureServiceImpl method getParticipantsLecturesStatistics.
@Override
public List<LectureBlockStatistics> getParticipantsLecturesStatistics(RepositoryEntry entry) {
boolean authorizedAbsenceEnabled = lectureModule.isAuthorizedAbsenceEnabled();
boolean calculateAttendanceRate = lectureModule.isRollCallCalculateAttendanceRateDefaultEnabled();
boolean absenceDefaultAuthorized = lectureModule.isAbsenceDefaultAuthorized();
boolean countAuthorizedAbsenceAsAttendant = lectureModule.isCountAuthorizedAbsenceAsAttendant();
double defaultRequiredAttendanceRate = lectureModule.getRequiredAttendanceRateDefault();
RepositoryEntryLectureConfiguration config = getRepositoryEntryLectureConfiguration(entry);
return lectureBlockRollCallDao.getStatistics(entry, config, authorizedAbsenceEnabled, absenceDefaultAuthorized, countAuthorizedAbsenceAsAttendant, calculateAttendanceRate, defaultRequiredAttendanceRate);
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class LectureServiceImpl method syncCalendars.
@Override
public void syncCalendars(RepositoryEntry entry) {
RepositoryEntryLectureConfiguration config = getRepositoryEntryLectureConfiguration(entry);
if (ConfigurationHelper.isSyncTeacherCalendarEnabled(config, lectureModule)) {
List<LectureBlock> blocks = getLectureBlocks(entry);
for (LectureBlock block : blocks) {
List<Identity> teachers = getTeachers(block);
syncInternalCalendar(block, teachers);
}
} else {
unsyncTeachersCalendar(entry);
}
if (ConfigurationHelper.isSyncCourseCalendarEnabled(config, lectureModule)) {
fullSyncCourseCalendar(config.getEntry());
} else {
unsyncInternalCalendar(config.getEntry());
}
/*if(ConfigurationHelper.isSyncParticipantCalendarEnabled(config, lectureModule)) {
List<LectureBlock> blocks = getLectureBlocks(entry);
for(LectureBlock block:blocks) {
List<Identity> participants = getParticipants(block);
syncInternalCalendar(block, participants);
}
} else {
unsyncParticipantsCalendar(entry);
}*/
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class LectureBlocksWebService method updateConfiguration.
/**
* Update the configuration of the lecture's feature of a specified
* course or repository entry.
* @response.representation.200.qname {http://www.example.com}repositoryEntryLectureConfigurationVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc The updated configuration
* @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @response.representation.404.doc The course not found
* @param configuration The configuration
* @param request The HTTP request
* @return It returns the updated configuration.
*/
@POST
@Path("configuration")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response updateConfiguration(RepositoryEntryLectureConfigurationVO configuration, @Context HttpServletRequest httpRequest) {
Roles roles = getRoles(httpRequest);
if (!roles.isOLATAdmin()) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
}
RepositoryEntryLectureConfiguration config = lectureService.getRepositoryEntryLectureConfiguration(entry);
if (configuration.getLectureEnabled() != null) {
config.setLectureEnabled(configuration.getLectureEnabled());
}
if (configuration.getCalculateAttendanceRate() != null) {
config.setCalculateAttendanceRate(configuration.getCalculateAttendanceRate());
}
if (configuration.getRequiredAttendanceRate() != null) {
config.setRequiredAttendanceRate(configuration.getRequiredAttendanceRate());
}
if (configuration.getOverrideModuleDefault() != null) {
config.setOverrideModuleDefault(configuration.getOverrideModuleDefault());
}
if (configuration.getCourseCalendarSyncEnabled() != null) {
config.setCourseCalendarSyncEnabled(configuration.getCourseCalendarSyncEnabled());
}
if (configuration.getRollCallEnabled() != null) {
config.setRollCallEnabled(configuration.getRollCallEnabled());
}
if (configuration.getTeacherCalendarSyncEnabled() != null) {
config.setTeacherCalendarSyncEnabled(configuration.getTeacherCalendarSyncEnabled());
}
RepositoryEntryLectureConfiguration updatedConfig = lectureService.updateRepositoryEntryLectureConfiguration(config);
return Response.ok(new RepositoryEntryLectureConfigurationVO(updatedConfig)).build();
}
Aggregations