use of org.olat.modules.lecture.model.AggregatedLectureBlocksStatistics in project OpenOLAT by OpenOLAT.
the class LectureBlockRollCallDAO method aggregatedStatistics.
public AggregatedLectureBlocksStatistics aggregatedStatistics(List<? extends LectureBlockStatistics> statisticsList, boolean countAuthorizedAbsenceAsAttendant) {
long totalPersonalPlannedLectures = 0;
long totalAttendedLectures = 0;
long totalAuthorizedAbsentLectures = 0;
long totalAbsentLectures = 0;
long attendedForRate = 0;
long absentForRate = 0;
for (LectureBlockStatistics statistics : statisticsList) {
totalPersonalPlannedLectures += statistics.getTotalPersonalPlannedLectures();
totalAuthorizedAbsentLectures += statistics.getTotalAuthorizedAbsentLectures();
totalAttendedLectures += statistics.getTotalAttendedLectures();
totalAbsentLectures += statistics.getTotalAbsentLectures();
attendedForRate += statistics.getTotalAttendedLectures();
absentForRate += statistics.getTotalAbsentLectures();
if (countAuthorizedAbsenceAsAttendant) {
attendedForRate += statistics.getTotalAuthorizedAbsentLectures();
} else {
absentForRate += statistics.getTotalAuthorizedAbsentLectures();
}
}
long totalLectures = attendedForRate + absentForRate;
double rate;
if (totalLectures == 0 || attendedForRate == 0) {
rate = 0.0d;
} else {
rate = (double) attendedForRate / (double) totalLectures;
}
double currentRate;
if (attendedForRate == 0) {
currentRate = 0.0d;
} else {
currentRate = attendedForRate / ((double) attendedForRate + (double) absentForRate);
}
return new AggregatedLectureBlocksStatistics(totalPersonalPlannedLectures, totalAttendedLectures, totalAuthorizedAbsentLectures, totalAbsentLectures, rate, currentRate);
}
use of org.olat.modules.lecture.model.AggregatedLectureBlocksStatistics in project openolat by klemens.
the class LectureBlockRollCallDAO method aggregatedStatistics.
public AggregatedLectureBlocksStatistics aggregatedStatistics(List<? extends LectureBlockStatistics> statisticsList, boolean countAuthorizedAbsenceAsAttendant) {
long totalPersonalPlannedLectures = 0;
long totalAttendedLectures = 0;
long totalAuthorizedAbsentLectures = 0;
long totalAbsentLectures = 0;
long attendedForRate = 0;
long absentForRate = 0;
for (LectureBlockStatistics statistics : statisticsList) {
totalPersonalPlannedLectures += statistics.getTotalPersonalPlannedLectures();
totalAuthorizedAbsentLectures += statistics.getTotalAuthorizedAbsentLectures();
totalAttendedLectures += statistics.getTotalAttendedLectures();
totalAbsentLectures += statistics.getTotalAbsentLectures();
attendedForRate += statistics.getTotalAttendedLectures();
absentForRate += statistics.getTotalAbsentLectures();
if (countAuthorizedAbsenceAsAttendant) {
attendedForRate += statistics.getTotalAuthorizedAbsentLectures();
} else {
absentForRate += statistics.getTotalAuthorizedAbsentLectures();
}
}
long totalLectures = attendedForRate + absentForRate;
double rate;
if (totalLectures == 0 || attendedForRate == 0) {
rate = 0.0d;
} else {
rate = (double) attendedForRate / (double) totalLectures;
}
double currentRate;
if (attendedForRate == 0) {
currentRate = 0.0d;
} else {
currentRate = attendedForRate / ((double) attendedForRate + (double) absentForRate);
}
return new AggregatedLectureBlocksStatistics(totalPersonalPlannedLectures, totalAttendedLectures, totalAuthorizedAbsentLectures, totalAbsentLectures, rate, currentRate);
}
use of org.olat.modules.lecture.model.AggregatedLectureBlocksStatistics 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.AggregatedLectureBlocksStatistics in project openolat by klemens.
the class LecturesListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (showExport) {
exportButton = uifactory.addFormLink("export", formLayout, Link.BUTTON);
exportButton.setIconLeftCSS("o_icon o_icon_download");
}
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, StatsCols.id));
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.username));
}
int colIndex = USER_PROPS_OFFSET;
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
boolean visible = userManager.isMandatoryUserProperty(propsIdentifier, userPropertyHandler);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex++, null, true, userPropertyHandler.i18nColumnDescriptorLabelKey()));
}
if (showRepositoryEntry) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.entry, "open.course"));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.plannedLectures));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.attendedLectures));
if (authorizedAbsenceEnabled) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.unauthorizedAbsenceLectures));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.authorizedAbsenceLectures));
} else {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.absentLectures));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.currentRate, new PercentCellRenderer()));
tableModel = new LecturesListDataModel(columnsModel, getTranslator());
AggregatedLectureBlocksStatistics total = lectureService.aggregatedStatistics(statistics);
tableModel.setObjects(statistics, total);
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
tableEl.setExportEnabled(true);
tableEl.setFooter(true);
}
use of org.olat.modules.lecture.model.AggregatedLectureBlocksStatistics in project OpenOLAT by OpenOLAT.
the class LecturesListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (showExport) {
exportButton = uifactory.addFormLink("export", formLayout, Link.BUTTON);
exportButton.setIconLeftCSS("o_icon o_icon_download");
}
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, StatsCols.id));
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.username));
}
int colIndex = USER_PROPS_OFFSET;
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
boolean visible = userManager.isMandatoryUserProperty(propsIdentifier, userPropertyHandler);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex++, null, true, userPropertyHandler.i18nColumnDescriptorLabelKey()));
}
if (showRepositoryEntry) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.entry, "open.course"));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.plannedLectures));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.attendedLectures));
if (authorizedAbsenceEnabled) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.unauthorizedAbsenceLectures));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.authorizedAbsenceLectures));
} else {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.absentLectures));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatsCols.currentRate, new PercentCellRenderer()));
tableModel = new LecturesListDataModel(columnsModel, getTranslator());
AggregatedLectureBlocksStatistics total = lectureService.aggregatedStatistics(statistics);
tableModel.setObjects(statistics, total);
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
tableEl.setExportEnabled(true);
tableEl.setFooter(true);
}
Aggregations