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);
}
}
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);
}
}
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());
}
}
}
}
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());
}
}
}
}
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());
}
Aggregations