use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.
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.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class ConfirmReopenController method formOK.
@Override
protected void formOK(UserRequest ureq) {
testSession = qtiService.reopenAssessmentTestSession(testSession, getIdentity());
if (testSession == null) {
showWarning("");
} else {
UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(testSession.getIdentity(), courseEnv);
ScoreEvaluation scoreEval = courseNode.getUserScoreEvaluation(assessedUserCourseEnv);
ScoreEvaluation reopenedScoreEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), AssessmentEntryStatus.inProgress, scoreEval.getUserVisible(), scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), AssessmentRunStatus.running, testSession.getKey());
courseNode.updateUserScoreEvaluation(reopenedScoreEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
ThreadLocalUserActivityLogger.log(QTI21LoggingAction.QTI_REOPEN_IN_COURSE, getClass());
}
fireEvent(ureq, Event.DONE_EVENT);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class PassedRuleSPI method filter.
@Override
public void filter(RepositoryEntry entry, List<Identity> identities, ReminderRule rule) {
if (rule instanceof ReminderRuleImpl) {
ReminderRuleImpl r = (ReminderRuleImpl) rule;
String nodeIdent = r.getLeftOperand();
String status = r.getRightOperand();
ICourse course = CourseFactory.loadCourse(entry);
CourseNode courseNode = course.getRunStructure().getNode(nodeIdent);
if (courseNode == null) {
identities.clear();
log.error("Passed rule in course " + entry.getKey() + " (" + entry.getDisplayname() + ") is missing a course element");
return;
}
Map<Long, Boolean> passeds;
if (courseNode instanceof STCourseNode) {
passeds = new HashMap<>();
STCourseNode structureNode = (STCourseNode) courseNode;
if (structureNode.hasPassedConfigured()) {
for (Identity identity : identities) {
UserCourseEnvironment uce = AssessmentHelper.createAndInitUserCourseEnvironment(identity, course);
ScoreEvaluation scoreEval = structureNode.getUserScoreEvaluation(uce);
Boolean passed = scoreEval.getPassed();
if (passed != null) {
passeds.put(identity.getKey(), passed);
}
}
}
} else {
passeds = helperDao.getPassed(entry, courseNode, identities);
}
if ("passed".equals(status)) {
for (Iterator<Identity> identityIt = identities.iterator(); identityIt.hasNext(); ) {
Boolean passed = passeds.get(identityIt.next().getKey());
if (passed == null || !passed.booleanValue()) {
identityIt.remove();
}
}
} else if ("failed".equals(status)) {
for (Iterator<Identity> identityIt = identities.iterator(); identityIt.hasNext(); ) {
Boolean passed = passeds.get(identityIt.next().getKey());
if (passed != null && passed.booleanValue()) {
identityIt.remove();
}
}
}
}
}
use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class QTI21ResetDataController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (courseNode instanceof IQTESTCourseNode) {
IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
RepositoryEntry testEntry = courseNode.getReferencedRepositoryEntry();
RepositoryEntry courseEntry = courseEnv.getCourseGroupManager().getCourseEntry();
ICourse course = CourseFactory.loadCourse(courseEntry);
archiveData(course, options);
qtiService.deleteAssessmentTestSession(identities, testEntry, courseEntry, courseNode.getIdent());
for (Identity identity : identities) {
ScoreEvaluation scoreEval = new ScoreEvaluation(null, null, AssessmentEntryStatus.notStarted, null, Boolean.FALSE, 0.0d, AssessmentRunStatus.notStarted, null);
IdentityEnvironment ienv = new IdentityEnvironment(identity, studentRoles);
UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, courseEnv);
testCourseNode.updateUserScoreEvaluation(scoreEval, uce, getIdentity(), false, Role.coach);
testCourseNode.updateCurrentCompletion(uce, getIdentity(), null, AssessmentRunStatus.notStarted, Role.coach);
}
} else if (assessedEntry != null) {
archiveData(assessedEntry);
qtiService.deleteAssessmentTestSession(identities, assessedEntry, null, null);
}
fireEvent(ureq, Event.CHANGED_EVENT);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.
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);
}
}
Aggregations