Search in sources :

Example 66 with UserCourseEnvironment

use of org.olat.course.run.userview.UserCourseEnvironment in project openolat by klemens.

the class QTI21RetrieveTestsController method doRetrieveTest.

private void doRetrieveTest(AssessmentTestSession session) {
    session = qtiService.getAssessmentTestSession(session.getKey());
    session = qtiService.pullSession(session, getSignatureOptions(session), getIdentity());
    if (courseNode != null) {
        RepositoryEntry courseEntry = session.getRepositoryEntry();
        CourseEnvironment courseEnv = CourseFactory.loadCourse(courseEntry).getCourseEnvironment();
        UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(session.getIdentity(), courseEnv);
        courseNode.pullAssessmentTestSession(session, assessedUserCourseEnv, getIdentity(), Role.coach);
    }
}
Also used : CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 67 with UserCourseEnvironment

use of org.olat.course.run.userview.UserCourseEnvironment in project openolat by klemens.

the class IdentityListCourseNodeController method doSetDone.

private void doSetDone(UserRequest ureq) {
    Set<Integer> selections = tableEl.getMultiSelectedIndex();
    List<AssessedIdentityElementRow> rows = new ArrayList<>(selections.size());
    for (Integer i : selections) {
        AssessedIdentityElementRow row = usersTableModel.getObject(i.intValue());
        if (row != null && row.getAssessmentStatus() != AssessmentEntryStatus.done) {
            rows.add(row);
        }
    }
    if (rows == null || rows.isEmpty()) {
        showWarning("warning.bulk.done");
    } else if (courseNode instanceof AssessableCourseNode) {
        ICourse course = CourseFactory.loadCourse(courseEntry);
        AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
        for (AssessedIdentityElementRow row : rows) {
            Identity assessedIdentity = securityManager.loadIdentityByKey(row.getIdentityKey());
            Roles roles = securityManager.getRoles(assessedIdentity);
            IdentityEnvironment identityEnv = new IdentityEnvironment(assessedIdentity, roles);
            UserCourseEnvironment assessedUserCourseEnv = new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment(), coachCourseEnv.isCourseReadOnly());
            assessedUserCourseEnv.getScoreAccounting().evaluateAll();
            ScoreEvaluation scoreEval = assessableCourseNode.getUserScoreEvaluation(assessedUserCourseEnv);
            ScoreEvaluation doneEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), AssessmentEntryStatus.done, null, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID());
            assessableCourseNode.updateUserScoreEvaluation(doneEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
        }
        loadModel(ureq);
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) Roles(org.olat.core.id.Roles) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) Identity(org.olat.core.id.Identity) IdentityEnvironment(org.olat.core.id.IdentityEnvironment)

Example 68 with UserCourseEnvironment

use of org.olat.course.run.userview.UserCourseEnvironment in project openolat by klemens.

the class GroupAssessmentController method applyChangesForTheWholeGroup.

private void applyChangesForTheWholeGroup(List<AssessmentRow> rows, boolean setAsDone, boolean userVisible) {
    ICourse course = CourseFactory.loadCourse(courseEntry);
    Float score = null;
    if (withScore) {
        String scoreValue = groupScoreEl.getValue();
        if (StringHelper.containsNonWhitespace(scoreValue)) {
            score = Float.parseFloat(scoreValue);
        }
    }
    Boolean passed = null;
    if (withPassed) {
        if (cutValue == null) {
            passed = groupPassedEl.isSelected(0);
        } else if (score != null) {
            passed = (score.floatValue() >= cutValue.floatValue()) ? Boolean.TRUE : Boolean.FALSE;
        }
    }
    for (AssessmentRow row : rows) {
        UserCourseEnvironment userCourseEnv = row.getUserCourseEnvironment(course);
        ScoreEvaluation newScoreEval;
        if (setAsDone) {
            newScoreEval = new ScoreEvaluation(score, passed, AssessmentEntryStatus.done, userVisible, true, null, null, null);
        } else {
            newScoreEval = new ScoreEvaluation(score, passed, null, userVisible, null, null, null, null);
        }
        gtaNode.updateUserScoreEvaluation(newScoreEval, userCourseEnv, getIdentity(), false, Role.coach);
    }
    if (withComment) {
        String comment = groupCommentEl.getValue();
        if (StringHelper.containsNonWhitespace(comment)) {
            for (AssessmentRow row : rows) {
                UserCourseEnvironment userCourseEnv = row.getUserCourseEnvironment(course);
                gtaNode.updateUserUserComment(comment, userCourseEnv, getIdentity());
            }
        }
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse)

Example 69 with UserCourseEnvironment

use of org.olat.course.run.userview.UserCourseEnvironment in project openolat by klemens.

the class GroupAssessmentController method applyChangesForEveryMemberGroup.

private void applyChangesForEveryMemberGroup(List<AssessmentRow> rows, boolean setAsDone, boolean userVisible) {
    ICourse course = CourseFactory.loadCourse(courseEntry);
    for (AssessmentRow row : rows) {
        UserCourseEnvironment userCourseEnv = row.getUserCourseEnvironment(course);
        Float score = null;
        if (withScore) {
            String value = row.getScoreEl().getValue();
            if (StringHelper.containsNonWhitespace(value)) {
                score = Float.parseFloat(value);
            }
        }
        Boolean passed = null;
        if (withPassed) {
            if (cutValue == null) {
                passed = row.getPassedEl().isSelected(0);
            } else if (score != null) {
                passed = (score.floatValue() >= cutValue.floatValue()) ? Boolean.TRUE : Boolean.FALSE;
            }
        }
        ScoreEvaluation newScoreEval;
        if (setAsDone) {
            newScoreEval = new ScoreEvaluation(score, passed, AssessmentEntryStatus.done, userVisible, true, null, null, null);
        } else {
            newScoreEval = new ScoreEvaluation(score, passed, null, userVisible, null, null, null, null);
        }
        gtaNode.updateUserScoreEvaluation(newScoreEval, userCourseEnv, getIdentity(), false, Role.coach);
        if (withComment) {
            String comment = row.getComment();
            if (StringHelper.containsNonWhitespace(comment)) {
                gtaNode.updateUserUserComment(comment, userCourseEnv, getIdentity());
            }
        }
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse)

Example 70 with UserCourseEnvironment

use of org.olat.course.run.userview.UserCourseEnvironment in project openolat by klemens.

the class GTACoachedParticipantGradingController method setAssessmentDatas.

private void setAssessmentDatas(UserRequest ureq) {
    removeAsListenerAndDispose(msCtrl);
    ICourse course = CourseFactory.loadCourse(courseOres);
    UserCourseEnvironment uce = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
    msCtrl = new MSCourseNodeRunController(ureq, getWindowControl(), uce, gtaNode, false, false, true);
    listenTo(msCtrl);
    mainVC.put("msrun", msCtrl.getInitialComponent());
}
Also used : MSCourseNodeRunController(org.olat.course.nodes.ms.MSCourseNodeRunController) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse)

Aggregations

UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)158 ICourse (org.olat.course.ICourse)84 Identity (org.olat.core.id.Identity)60 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)58 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)54 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)52 CourseNode (org.olat.course.nodes.CourseNode)42 RepositoryEntry (org.olat.repository.RepositoryEntry)42 Test (org.junit.Test)28 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)24 ConditionInterpreter (org.olat.course.condition.interpreter.ConditionInterpreter)20 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)16 Roles (org.olat.core.id.Roles)14 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)14 ArrayList (java.util.ArrayList)12 VFSContainer (org.olat.core.util.vfs.VFSContainer)12 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)12 OLATResource (org.olat.resource.OLATResource)12 Date (java.util.Date)10 AssessmentManager (org.olat.course.assessment.AssessmentManager)10