Search in sources :

Example 1 with QTICourseNode

use of org.olat.course.nodes.QTICourseNode in project OpenOLAT by OpenOLAT.

the class AttemptsRuleEditor method searchAttemptableNodes.

private void searchAttemptableNodes(CourseNode courseNode, List<CourseNode> nodes) {
    if (courseNode instanceof AssessableCourseNode) {
        AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
        if (assessableCourseNode.hasAttemptsConfigured()) {
            nodes.add(courseNode);
        }
    } else if (courseNode instanceof QTICourseNode) {
        QTICourseNode assessableCourseNode = (QTICourseNode) courseNode;
        if (assessableCourseNode.hasAttemptsConfigured()) {
            nodes.add(courseNode);
        }
    }
    for (int i = 0; i < courseNode.getChildCount(); i++) {
        CourseNode child = (CourseNode) courseNode.getChildAt(i);
        searchAttemptableNodes(child, nodes);
    }
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) QTICourseNode(org.olat.course.nodes.QTICourseNode) QTICourseNode(org.olat.course.nodes.QTICourseNode)

Example 2 with QTICourseNode

use of org.olat.course.nodes.QTICourseNode in project openolat by klemens.

the class AttemptsRuleEditor method searchAttemptableNodes.

private void searchAttemptableNodes(CourseNode courseNode, List<CourseNode> nodes) {
    if (courseNode instanceof AssessableCourseNode) {
        AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
        if (assessableCourseNode.hasAttemptsConfigured()) {
            nodes.add(courseNode);
        }
    } else if (courseNode instanceof QTICourseNode) {
        QTICourseNode assessableCourseNode = (QTICourseNode) courseNode;
        if (assessableCourseNode.hasAttemptsConfigured()) {
            nodes.add(courseNode);
        }
    }
    for (int i = 0; i < courseNode.getChildCount(); i++) {
        CourseNode child = (CourseNode) courseNode.getChildAt(i);
        searchAttemptableNodes(child, nodes);
    }
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) QTICourseNode(org.olat.course.nodes.QTICourseNode) QTICourseNode(org.olat.course.nodes.QTICourseNode)

Example 3 with QTICourseNode

use of org.olat.course.nodes.QTICourseNode in project OpenOLAT by OpenOLAT.

the class IQConfigurationController method doConfirmChangeTestAndSurvey.

/**
 * This check if there is some QTI 2.1 results for the current selected test.
 *
 * @param ureq
 * @param newEntry
 */
private void doConfirmChangeTestAndSurvey(UserRequest ureq, RepositoryEntry newEntry) {
    try {
        RepositoryEntry currentEntry = courseNode.getReferencedRepositoryEntry();
        RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
        int numOfAssessedIdentities = 0;
        if (currentEntry != null) {
            List<AssessmentTestSession> assessmentTestSessions = qti21service.getAssessmentTestSessions(courseEntry, courseNode.getIdent(), currentEntry);
            Set<Identity> assessedIdentities = new HashSet<>();
            for (AssessmentTestSession assessmentTestSession : assessmentTestSessions) {
                if (StringHelper.containsNonWhitespace(assessmentTestSession.getAnonymousIdentifier())) {
                    numOfAssessedIdentities++;
                } else if (assessmentTestSession.getIdentity() != null) {
                    assessedIdentities.add(assessmentTestSession.getIdentity());
                }
            }
            numOfAssessedIdentities += assessedIdentities.size();
        }
        if (numOfAssessedIdentities > 0) {
            confirmChangeResourceCtrl = new ConfirmChangeResourceController(ureq, getWindowControl(), course, (QTICourseNode) courseNode, newEntry, currentEntry, numOfAssessedIdentities);
            listenTo(confirmChangeResourceCtrl);
            cmc = new CloseableModalController(getWindowControl(), translate("close"), confirmChangeResourceCtrl.getInitialComponent());
            listenTo(cmc);
            cmc.activate();
        } else {
            doChangeResource(ureq, newEntry);
        }
    } catch (Exception e) {
        logError("", e);
        showError("error.resource.corrupted");
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) HashSet(java.util.HashSet) QTICourseNode(org.olat.course.nodes.QTICourseNode)

Example 4 with QTICourseNode

use of org.olat.course.nodes.QTICourseNode in project openolat by klemens.

the class IQConfigurationController method doConfirmChangeTestAndSurvey.

/**
 * This check if there is some QTI 2.1 results for the current selected test.
 *
 * @param ureq
 * @param newEntry
 */
private void doConfirmChangeTestAndSurvey(UserRequest ureq, RepositoryEntry newEntry) {
    try {
        RepositoryEntry currentEntry = courseNode.getReferencedRepositoryEntry();
        RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
        int numOfAssessedIdentities = 0;
        if (currentEntry != null) {
            List<AssessmentTestSession> assessmentTestSessions = qti21service.getAssessmentTestSessions(courseEntry, courseNode.getIdent(), currentEntry);
            Set<Identity> assessedIdentities = new HashSet<>();
            for (AssessmentTestSession assessmentTestSession : assessmentTestSessions) {
                if (StringHelper.containsNonWhitespace(assessmentTestSession.getAnonymousIdentifier())) {
                    numOfAssessedIdentities++;
                } else if (assessmentTestSession.getIdentity() != null) {
                    assessedIdentities.add(assessmentTestSession.getIdentity());
                }
            }
            numOfAssessedIdentities += assessedIdentities.size();
        }
        if (numOfAssessedIdentities > 0) {
            confirmChangeResourceCtrl = new ConfirmChangeResourceController(ureq, getWindowControl(), course, (QTICourseNode) courseNode, newEntry, currentEntry, numOfAssessedIdentities);
            listenTo(confirmChangeResourceCtrl);
            cmc = new CloseableModalController(getWindowControl(), translate("close"), confirmChangeResourceCtrl.getInitialComponent());
            listenTo(cmc);
            cmc.activate();
        } else {
            doChangeResource(ureq, newEntry);
        }
    } catch (Exception e) {
        logError("", e);
        showError("error.resource.corrupted");
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) HashSet(java.util.HashSet) QTICourseNode(org.olat.course.nodes.QTICourseNode)

Aggregations

QTICourseNode (org.olat.course.nodes.QTICourseNode)4 HashSet (java.util.HashSet)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 Identity (org.olat.core.id.Identity)2 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)2 CourseNode (org.olat.course.nodes.CourseNode)2 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2