use of org.olat.course.run.scoring.AssessmentEvaluation in project openolat by klemens.
the class PortfolioServiceImpl method setAssessmentStatus.
@Override
public void setAssessmentStatus(Identity assessedIdentity, BinderRef binderRef, AssessmentEntryStatus status, Identity coachingIdentity) {
Boolean fullyAssessed = Boolean.FALSE;
if (status == AssessmentEntryStatus.done) {
fullyAssessed = Boolean.TRUE;
}
Binder binder = binderDao.loadByKey(binderRef.getKey());
RepositoryEntry entry = binder.getEntry();
if ("CourseModule".equals(entry.getOlatResource().getResourceableTypeName())) {
ICourse course = CourseFactory.loadCourse(entry);
CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent());
if (courseNode instanceof PortfolioCourseNode) {
PortfolioCourseNode pfNode = (PortfolioCourseNode) courseNode;
UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
AssessmentEvaluation eval = pfNode.getUserScoreEvaluation(userCourseEnv);
ScoreEvaluation scoreEval = new ScoreEvaluation(eval.getScore(), eval.getPassed(), status, true, fullyAssessed, null, null, binder.getKey());
pfNode.updateUserScoreEvaluation(scoreEval, userCourseEnv, coachingIdentity, false, Role.coach);
}
} else {
OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
assessmentEntry.setFullyAssessed(fullyAssessed);
assessmentEntry.setAssessmentStatus(status);
assessmentService.updateAssessmentEntry(assessmentEntry);
}
}
use of org.olat.course.run.scoring.AssessmentEvaluation in project openolat by klemens.
the class CourseAssessmentManagerImpl method createAssessmentEntry.
@Override
public AssessmentEntry createAssessmentEntry(CourseNode courseNode, Identity assessedIdentity, ScoreEvaluation scoreEvaluation) {
RepositoryEntry referenceEntry = null;
if (courseNode.needsReferenceToARepositoryEntry()) {
referenceEntry = courseNode.getReferencedRepositoryEntry();
}
Float score = null;
Boolean passed = null;
Date lastUserModified = null;
Date lastCoachModified = null;
if (scoreEvaluation != null) {
score = scoreEvaluation.getScore();
passed = scoreEvaluation.getPassed();
}
if (scoreEvaluation instanceof AssessmentEvaluation) {
AssessmentEvaluation eval = (AssessmentEvaluation) scoreEvaluation;
lastCoachModified = eval.getLastCoachModified();
lastUserModified = eval.getLastUserModified();
}
return assessmentService.createAssessmentEntry(assessedIdentity, null, cgm.getCourseEntry(), courseNode.getIdent(), referenceEntry, score, passed, lastUserModified, lastCoachModified);
}
use of org.olat.course.run.scoring.AssessmentEvaluation in project openolat by klemens.
the class STCourseNode method getUserScoreEvaluation.
/**
* the structure node does not have a score itself, but calculates the
* score/passed info by evaluating the configured expression in the the
* (condition)interpreter.
*
* @see org.olat.course.nodes.AssessableCourseNode#getUserScoreEvaluation(org.olat.course.run.userview.UserCourseEnvironment)
*/
@Override
public AssessmentEvaluation getUserScoreEvaluation(UserCourseEnvironment userCourseEnv) {
Float score = null;
Boolean passed = null;
if (scoreCalculator == null) {
// this is a not-computable course node at the moment (no scoring/passing rules defined)
return null;
}
String scoreExpressionStr = scoreCalculator.getScoreExpression();
String passedExpressionStr = scoreCalculator.getPassedExpression();
ConditionInterpreter ci = userCourseEnv.getConditionInterpreter();
if (scoreExpressionStr != null) {
score = new Float(ci.evaluateCalculation(scoreExpressionStr));
}
if (passedExpressionStr != null) {
passed = new Boolean(ci.evaluateCondition(passedExpressionStr));
}
return new AssessmentEvaluation(score, passed);
}
use of org.olat.course.run.scoring.AssessmentEvaluation in project openolat by klemens.
the class GTACoachedParticipantGradingController method doGraded.
private void doGraded(UserRequest ureq, UserCourseEnvironment assessedUserCourseEnv) {
removeAsListenerAndDispose(msCtrl);
msCtrl = new MSCourseNodeRunController(ureq, getWindowControl(), assessedUserCourseEnv, gtaNode, false, false, true);
listenTo(msCtrl);
mainVC.put("msrun", msCtrl.getInitialComponent());
AssessmentEvaluation scoreEval = gtaNode.getUserScoreEvaluation(assessedUserCourseEnv);
if (scoreEval.getAssessmentStatus() == AssessmentEntryStatus.done) {
if (assignedTask == null) {
RepositoryEntry courseEntry = coachCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
TaskList taskList = gtaManager.createIfNotExists(courseEntry, gtaNode);
assignedTask = gtaManager.createTask(null, taskList, TaskProcess.graded, null, assessedIdentity, gtaNode);
} else {
assignedTask = gtaManager.updateTask(assignedTask, TaskProcess.graded, gtaNode, Role.coach);
}
fireEvent(ureq, Event.CHANGED_EVENT);
}
}
use of org.olat.course.run.scoring.AssessmentEvaluation in project openolat by klemens.
the class ReturnboxFullAccessCallback method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == dropboxFolderRunController) {
if (event instanceof FolderEvent) {
FolderEvent folderEvent = (FolderEvent) event;
if (folderEvent.getCommand().equals(FolderEvent.DELETE_EVENT)) {
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
// log entry for this file
Identity coach = ureq.getIdentity();
Identity student = userCourseEnv.getIdentityEnvironment().getIdentity();
am.appendToUserNodeLog(node, coach, student, "FILE DELETED: " + folderEvent.getFilename());
}
}
} else if (source == returnboxFolderRunController) {
if (event instanceof FolderEvent) {
FolderEvent folderEvent = (FolderEvent) event;
if (folderEvent.getCommand().equals(FolderEvent.UPLOAD_EVENT) || folderEvent.getCommand().equals(FolderEvent.NEW_FILE_EVENT)) {
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
// log entry for this file
Identity coach = ureq.getIdentity();
Identity student = userCourseEnv.getIdentityEnvironment().getIdentity();
if (node instanceof AssessableCourseNode) {
AssessableCourseNode acn = (AssessableCourseNode) node;
AssessmentEvaluation eval = acn.getUserScoreEvaluation(userCourseEnv);
if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
acn.updateUserScoreEvaluation(eval, userCourseEnv, coach, false, Role.coach);
}
}
am.appendToUserNodeLog(node, coach, student, "FILE UPLOADED: " + folderEvent.getFilename());
String toMail = UserManager.getInstance().getUserDisplayEmail(student, ureq.getLocale());
OLATResourceable ores = OresHelper.createOLATResourceableInstance(CourseNode.class, Long.valueOf(node.getIdent()));
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ores);
BusinessControl bc = BusinessControlFactory.getInstance().createBusinessControl(ce, getWindowControl().getBusinessControl());
String link = BusinessControlFactory.getInstance().getAsURIString(bc, true);
log.debug("DEBUG : Returnbox notification email with link=" + link);
String subject = translate("returnbox.email.subject");
String body = translate("returnbox.email.body", new String[] { userCourseEnv.getCourseEnvironment().getCourseTitle(), node.getShortTitle(), folderEvent.getFilename(), link });
MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString());
MailBundle bundle = new MailBundle();
bundle.setContext(context);
bundle.setToId(student);
bundle.setContent(subject, body);
MailerResult result = CoreSpringFactory.getImpl(MailManager.class).sendMessage(bundle);
if (result.getReturnCode() > 0) {
am.appendToUserNodeLog(node, coach, student, "MAIL SEND FAILED TO:" + toMail + "; MailReturnCode: " + result.getReturnCode());
log.warn("Could not send email 'returnbox notification' to " + student + "with email=" + toMail);
} else {
log.info("Send email 'returnbox notification' to " + student + "with email=" + toMail);
}
}
} else if (FolderCommand.FOLDERCOMMAND_FINISHED == event) {
if (node instanceof AssessableCourseNode) {
AssessableCourseNode acn = (AssessableCourseNode) node;
AssessmentEvaluation eval = acn.getUserScoreEvaluation(userCourseEnv);
if (eval == null) {
eval = AssessmentEvaluation.EMPTY_EVAL;
}
if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
acn.updateUserScoreEvaluation(eval, userCourseEnv, getIdentity(), false, Role.coach);
fireEvent(ureq, Event.CHANGED_EVENT);
}
}
}
} else if (source == statusForm) {
if (event == Event.DONE_EVENT) {
// get identity not from request (this would be an author)
StatusManager.getInstance().saveStatusFormData(statusForm, node, userCourseEnv);
}
} else if (source == dialogBoxController) {
if (DialogBoxUIFactory.isYesEvent(event) && assignedTask != null) {
// cancel task assignment, and show "no task assigned to user"
removeAssignedTask(userCourseEnv, userCourseEnv.getIdentityEnvironment().getIdentity());
// update UI
myContent.contextPut("assignedtask", null);
}
}
}
Aggregations