Search in sources :

Example 1 with AssessmentTestSessionDetailsComparator

use of org.olat.course.nodes.iq.QTI21IdentityListCourseNodeToolsController.AssessmentTestSessionDetailsComparator in project OpenOLAT by OpenOLAT.

the class IQIdentityListCourseNodeController method doConfirmExtraTime.

private void doConfirmExtraTime(UserRequest ureq) {
    List<IdentityRef> identities = getSelectedIdentities();
    if (identities == null || identities.isEmpty()) {
        showWarning("warning.users.extra.time");
        return;
    }
    List<AssessmentTestSession> testSessions = new ArrayList<>(identities.size());
    for (IdentityRef identity : identities) {
        List<AssessmentTestSessionStatistics> sessionsStatistics = qtiService.getAssessmentTestSessionsStatistics(getCourseRepositoryEntry(), courseNode.getIdent(), identity);
        if (!sessionsStatistics.isEmpty()) {
            if (sessionsStatistics.size() > 1) {
                Collections.sort(sessionsStatistics, new AssessmentTestSessionDetailsComparator());
            }
            AssessmentTestSession lastSession = sessionsStatistics.get(0).getTestSession();
            if (lastSession != null && lastSession.getFinishTime() == null) {
                testSessions.add(lastSession);
            }
        }
    }
    if (testSessions == null || testSessions.isEmpty()) {
        showWarning("warning.users.extra.time");
        return;
    }
    extraTimeCtrl = new ConfirmExtraTimeController(ureq, getWindowControl(), getCourseRepositoryEntry(), testSessions);
    listenTo(extraTimeCtrl);
    String title = translate("extra.time");
    cmc = new CloseableModalController(getWindowControl(), null, extraTimeCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) AssessmentTestSessionDetailsComparator(org.olat.course.nodes.iq.QTI21IdentityListCourseNodeToolsController.AssessmentTestSessionDetailsComparator) AssessmentTestSessionStatistics(org.olat.ims.qti21.model.jpa.AssessmentTestSessionStatistics) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) IdentityRef(org.olat.basesecurity.IdentityRef) ArrayList(java.util.ArrayList)

Example 2 with AssessmentTestSessionDetailsComparator

use of org.olat.course.nodes.iq.QTI21IdentityListCourseNodeToolsController.AssessmentTestSessionDetailsComparator in project openolat by klemens.

the class IQIdentityListCourseNodeController method doConfirmExtraTime.

private void doConfirmExtraTime(UserRequest ureq) {
    List<IdentityRef> identities = getSelectedIdentities();
    if (identities == null || identities.isEmpty()) {
        showWarning("warning.users.extra.time");
        return;
    }
    List<AssessmentTestSession> testSessions = new ArrayList<>(identities.size());
    for (IdentityRef identity : identities) {
        List<AssessmentTestSessionStatistics> sessionsStatistics = qtiService.getAssessmentTestSessionsStatistics(getCourseRepositoryEntry(), courseNode.getIdent(), identity);
        if (!sessionsStatistics.isEmpty()) {
            if (sessionsStatistics.size() > 1) {
                Collections.sort(sessionsStatistics, new AssessmentTestSessionDetailsComparator());
            }
            AssessmentTestSession lastSession = sessionsStatistics.get(0).getTestSession();
            if (lastSession != null && lastSession.getFinishTime() == null) {
                testSessions.add(lastSession);
            }
        }
    }
    if (testSessions == null || testSessions.isEmpty()) {
        showWarning("warning.users.extra.time");
        return;
    }
    extraTimeCtrl = new ConfirmExtraTimeController(ureq, getWindowControl(), getCourseRepositoryEntry(), testSessions);
    listenTo(extraTimeCtrl);
    String title = translate("extra.time");
    cmc = new CloseableModalController(getWindowControl(), null, extraTimeCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) AssessmentTestSessionDetailsComparator(org.olat.course.nodes.iq.QTI21IdentityListCourseNodeToolsController.AssessmentTestSessionDetailsComparator) AssessmentTestSessionStatistics(org.olat.ims.qti21.model.jpa.AssessmentTestSessionStatistics) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) IdentityRef(org.olat.basesecurity.IdentityRef) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 IdentityRef (org.olat.basesecurity.IdentityRef)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 AssessmentTestSessionDetailsComparator (org.olat.course.nodes.iq.QTI21IdentityListCourseNodeToolsController.AssessmentTestSessionDetailsComparator)2 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)2 AssessmentTestSessionStatistics (org.olat.ims.qti21.model.jpa.AssessmentTestSessionStatistics)2