use of org.olat.modules.lecture.model.LectureBlockStatistics in project openolat by klemens.
the class ParticipantLecturesOverviewController method loadModel.
private void loadModel() {
List<LectureBlockStatistics> statistics = lectureService.getParticipantLecturesStatistics(assessedIdentity);
AggregatedLectureBlocksStatistics total = lectureService.aggregatedStatistics(statistics);
tableModel.setObjects(statistics, total);
tableEl.reset(true, true, true);
}
use of org.olat.modules.lecture.model.LectureBlockStatistics in project openolat by klemens.
the class ParticipantListRepositoryController method loadModel.
private void loadModel() {
List<Identity> participants;
if (admin) {
participants = lectureService.getParticipants(entry);
} else {
participants = lectureService.getParticipants(entry, getIdentity());
}
List<LectureBlockStatistics> statistics = lectureService.getParticipantsLecturesStatistics(entry);
Map<Long, LectureBlockStatistics> identityToStatisticsMap = statistics.stream().collect(Collectors.toMap(s -> s.getIdentityKey(), s -> s));
List<ParticipantRow> rows = new ArrayList<>(participants.size());
for (Identity participant : participants) {
LectureBlockStatistics stats = identityToStatisticsMap.get(participant.getKey());
rows.add(new ParticipantRow(participant, stats, userPropertyHandlers, getLocale()));
}
tableModel.setObjects(rows);
tableEl.reset(false, false, true);
}
use of org.olat.modules.lecture.model.LectureBlockStatistics in project openolat by klemens.
the class LectureStatisticsCellRenderer method render.
@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator translator) {
if (cellValue instanceof LectureBlockStatistics) {
LectureBlockStatistics stats = (LectureBlockStatistics) cellValue;
long total = stats.getTotalPersonalPlannedLectures();
long attended = stats.getTotalAttendedLectures();
long absent = stats.getTotalAbsentLectures();
long authorizedAbsent = stats.getTotalAuthorizedAbsentLectures();
render(target, total, attended, absent, authorizedAbsent);
}
}
use of org.olat.modules.lecture.model.LectureBlockStatistics in project OpenOLAT by OpenOLAT.
the class LectureServiceTest method getLectureStatistics_checkQuerySyntax.
@Test
public void getLectureStatistics_checkQuerySyntax() {
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("participant-5-1");
// a lecture block
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = createMinimalLectureBlock(entry);
// add participant to the "course"
repositoryEntryRelationDAO.addRole(participant, entry, GroupRole.participant.name());
dbInstance.commitAndCloseSession();
// enable lectures
RepositoryEntryLectureConfiguration config = lectureService.getRepositoryEntryLectureConfiguration(entry);
config.setLectureEnabled(true);
lectureService.updateRepositoryEntryLectureConfiguration(config);
// add the course to the lecture
Group defGroup = repositoryService.getDefaultGroup(entry);
lectureBlock = lectureService.save(lectureBlock, Collections.singletonList(defGroup));
dbInstance.commitAndCloseSession();
lectureService.addRollCall(participant, lectureBlock, null, Collections.singletonList(3));
dbInstance.commitAndCloseSession();
// add
List<LectureBlockStatistics> statistics = lectureService.getParticipantLecturesStatistics(participant);
Assert.assertNotNull(statistics);
Assert.assertEquals(1, statistics.size());
}
use of org.olat.modules.lecture.model.LectureBlockStatistics in project OpenOLAT by OpenOLAT.
the class RateWarningCellRenderer method render.
@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator trans) {
if (cellValue instanceof LectureBlockStatistics) {
LectureBlockStatistics stats = (LectureBlockStatistics) cellValue;
if (stats.isCalculateRate() && stats.getTotalPersonalPlannedLectures() > 0 && (stats.getTotalAbsentLectures() > 0 || stats.getTotalAttendedLectures() > 0 || stats.getTotalAuthorizedAbsentLectures() > 0)) {
double attendanceRate = stats.getAttendanceRate();
double requiredRate = stats.getRequiredRate();
if (requiredRate > attendanceRate) {
String title = translator.translate("rate.error.title");
target.append("<i class='o_icon o_icon-lg o_icon_error' title='").append(title).append("'> </i>");
} else if (attendanceRate - requiredRate < 0.05) {
// less than 5%
String title = translator.translate("rate.warning.title");
target.append("<i class='o_icon o_icon-lg o_icon_warning' title='").append(title).append("'> </i>");
}
}
}
}
Aggregations