Search in sources :

Example 11 with LectureBlockStatistics

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);
}
Also used : AggregatedLectureBlocksStatistics(org.olat.modules.lecture.model.AggregatedLectureBlocksStatistics) LectureBlockStatistics(org.olat.modules.lecture.model.LectureBlockStatistics)

Example 12 with LectureBlockStatistics

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);
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) PercentCellRenderer(org.olat.modules.lecture.ui.component.PercentCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) RepositoryEntry(org.olat.repository.RepositoryEntry) RepositoryEntryLectureConfiguration(org.olat.modules.lecture.RepositoryEntryLectureConfiguration) LectureStatisticsCellRenderer(org.olat.modules.lecture.ui.component.LectureStatisticsCellRenderer) ParticipantInfosRenderer(org.olat.modules.lecture.ui.component.ParticipantInfosRenderer) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) UserConstants(org.olat.core.id.UserConstants) Map(java.util.Map) SortKey(org.olat.core.commons.persistence.SortKey) LectureBlockStatistics(org.olat.modules.lecture.model.LectureBlockStatistics) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) LectureModule(org.olat.modules.lecture.LectureModule) RateWarningCellRenderer(org.olat.modules.lecture.ui.component.RateWarningCellRenderer) WindowControl(org.olat.core.gui.control.WindowControl) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) ParticipantsCols(org.olat.modules.lecture.ui.ParticipantListDataModel.ParticipantsCols) Component(org.olat.core.gui.components.Component) Collectors(java.util.stream.Collectors) Controller(org.olat.core.gui.control.Controller) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserManager(org.olat.user.UserManager) BaseFullWebappPopupLayoutFactory(org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) LectureService(org.olat.modules.lecture.LectureService) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) List(java.util.List) Identity(org.olat.core.id.Identity) LongCellRenderer(org.olat.modules.lecture.ui.component.LongCellRenderer) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) UserRequest(org.olat.core.gui.UserRequest) BaseSecurity(org.olat.basesecurity.BaseSecurity) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) Roles(org.olat.core.id.Roles) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity) LectureBlockStatistics(org.olat.modules.lecture.model.LectureBlockStatistics)

Example 13 with LectureBlockStatistics

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);
    }
}
Also used : LectureBlockStatistics(org.olat.modules.lecture.model.LectureBlockStatistics)

Example 14 with LectureBlockStatistics

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());
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) Group(org.olat.basesecurity.Group) LectureBlockToGroup(org.olat.modules.lecture.LectureBlockToGroup) BusinessGroup(org.olat.group.BusinessGroup) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) RepositoryEntryLectureConfiguration(org.olat.modules.lecture.RepositoryEntryLectureConfiguration) LectureBlockStatistics(org.olat.modules.lecture.model.LectureBlockStatistics) Test(org.junit.Test)

Example 15 with LectureBlockStatistics

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>");
            }
        }
    }
}
Also used : LectureBlockStatistics(org.olat.modules.lecture.model.LectureBlockStatistics)

Aggregations

LectureBlockStatistics (org.olat.modules.lecture.model.LectureBlockStatistics)24 Identity (org.olat.core.id.Identity)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 RepositoryEntryLectureConfiguration (org.olat.modules.lecture.RepositoryEntryLectureConfiguration)6 Test (org.junit.Test)4 Group (org.olat.basesecurity.Group)4 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)4 BusinessGroup (org.olat.group.BusinessGroup)4 LectureBlock (org.olat.modules.lecture.LectureBlock)4 LectureBlockToGroup (org.olat.modules.lecture.LectureBlockToGroup)4 AggregatedLectureBlocksStatistics (org.olat.modules.lecture.model.AggregatedLectureBlocksStatistics)4 HashMap (java.util.HashMap)3 Calendar (java.util.Calendar)2 List (java.util.List)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Collectors (java.util.stream.Collectors)2 BaseSecurity (org.olat.basesecurity.BaseSecurity)2