use of org.olat.course.run.scoring.AssessmentEvaluation in project openolat by klemens.
the class TaskController method setAssignedTask.
private void setAssignedTask(Identity identity, String task) {
CoursePropertyManager cpm = courseEnv.getCoursePropertyManager();
Property p = cpm.createCourseNodePropertyInstance(node, identity, null, PROP_ASSIGNED, null, null, task, null);
cpm.saveProperty(p);
AssessmentEvaluation eval = node.getUserScoreEvaluation(userCourseEnv);
if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
node.updateUserScoreEvaluation(eval, userCourseEnv, getIdentity(), false, Role.user);
}
}
use of org.olat.course.run.scoring.AssessmentEvaluation in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class AssessmentHelper method getAssessmentNodeDataList.
public static int getAssessmentNodeDataList(int recursionLevel, CourseNode courseNode, ScoreAccounting scoreAccounting, UserCourseEnvironment userCourseEnv, boolean followUserVisibility, boolean discardEmptyNodes, boolean discardComments, List<AssessmentNodeData> data, AssessmentNodesLastModified lastModifications) {
// 1) Get list of children data using recursion of this method
AssessmentNodeData assessmentNodeData = new AssessmentNodeData(recursionLevel, courseNode);
data.add(assessmentNodeData);
int numOfChildren = 0;
for (int i = 0; i < courseNode.getChildCount(); i++) {
CourseNode child = (CourseNode) courseNode.getChildAt(i);
numOfChildren += getAssessmentNodeDataList(recursionLevel + 1, child, scoreAccounting, userCourseEnv, followUserVisibility, discardEmptyNodes, discardComments, data, lastModifications);
}
// 2) Get data of this node only if
// - it has any wrapped children or
// - it is of an assessable course node type
boolean hasDisplayableValuesConfigured = false;
boolean hasDisplayableUserValues = false;
if (numOfChildren > 0 || courseNode instanceof AssessableCourseNode) {
if (courseNode instanceof ProjectBrokerCourseNode) {
// ProjectBroker : no assessment-tool in V1.0 , remove project broker completely form assessment-tool gui
assessmentNodeData.setSelectable(false);
} else if (courseNode instanceof AssessableCourseNode) {
AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
AssessmentEvaluation scoreEvaluation = scoreAccounting.evalCourseNode(assessableCourseNode);
if (scoreEvaluation != null) {
assessmentNodeData.setAssessmentStatus(scoreEvaluation.getAssessmentStatus());
assessmentNodeData.setNumOfAssessmentDocs(scoreEvaluation.getNumOfAssessmentDocs());
}
assessmentNodeData.setUserVisibility(scoreEvaluation.getUserVisible());
assessmentNodeData.setLastModified(scoreEvaluation.getLastModified());
assessmentNodeData.setLastUserModified(scoreEvaluation.getLastUserModified());
assessmentNodeData.setLastCoachModified(scoreEvaluation.getLastCoachModified());
if (lastModifications != null) {
lastModifications.addLastModified(scoreEvaluation.getLastModified());
lastModifications.addLastUserModified(scoreEvaluation.getLastUserModified());
lastModifications.addLastCoachModified(scoreEvaluation.getLastCoachModified());
}
if (!followUserVisibility || scoreEvaluation.getUserVisible() == null || scoreEvaluation.getUserVisible().booleanValue()) {
// details
if (assessableCourseNode.hasDetails()) {
hasDisplayableValuesConfigured = true;
String detailValue = assessableCourseNode.getDetailsListView(userCourseEnv);
if (detailValue == null) {
// ignore unset details in discardEmptyNodes mode
assessmentNodeData.setDetails(AssessmentHelper.DETAILS_NA_VALUE);
} else {
assessmentNodeData.setDetails(detailValue);
hasDisplayableUserValues = true;
}
}
// attempts
if (assessableCourseNode.hasAttemptsConfigured()) {
hasDisplayableValuesConfigured = true;
Integer attemptsValue = scoreEvaluation.getAttempts();
if (attemptsValue != null) {
assessmentNodeData.setAttempts(attemptsValue);
if (attemptsValue.intValue() > 0) {
// ignore attempts = 0 in discardEmptyNodes mode
hasDisplayableUserValues = true;
}
}
}
// score
if (assessableCourseNode.hasScoreConfigured()) {
hasDisplayableValuesConfigured = true;
Float score = scoreEvaluation.getScore();
if (score != null) {
assessmentNodeData.setRoundedScore(AssessmentHelper.getRoundedScore(score));
assessmentNodeData.setScore(score);
hasDisplayableUserValues = true;
}
if (!(assessableCourseNode instanceof STCourseNode)) {
assessmentNodeData.setMaxScore(assessableCourseNode.getMaxScoreConfiguration());
assessmentNodeData.setMinScore(assessableCourseNode.getMinScoreConfiguration());
}
}
// passed
if (assessableCourseNode.hasPassedConfigured()) {
hasDisplayableValuesConfigured = true;
Boolean passed = scoreEvaluation.getPassed();
if (passed != null) {
assessmentNodeData.setPassed(passed);
hasDisplayableUserValues = true;
}
}
}
// selection command available
AssessableCourseNode acn = (AssessableCourseNode) courseNode;
if (acn.isEditableConfigured()) {
// Assessable course nodes are selectable
assessmentNodeData.setSelectable(true);
} else {
// assessable nodes that do not have score or passed are not selectable
// (e.g. a st node with no defined rule
assessmentNodeData.setSelectable(false);
}
if (!hasDisplayableUserValues && assessableCourseNode.hasCommentConfigured() && !discardComments) {
// comments are invisible in the table but if configured the node must be in the list
// for the efficiency statement this can be ignored, this is the case when discardComments is true
hasDisplayableValuesConfigured = true;
if (assessableCourseNode.getUserUserComment(userCourseEnv) != null) {
hasDisplayableUserValues = true;
}
}
} else {
// Not assessable nodes are not selectable. (e.g. a node that
// has an assessable child node but is itself not assessable)
assessmentNodeData.setSelectable(false);
}
}
// 3) Add data of this node to mast list if node assessable or children list has any data.
// Do only add nodes when they have any assessable element, otherwhise discard (e.g. empty course,
// structure nodes without scoring rules)! When the discardEmptyNodes flag is set then only
// add this node when there is user data found for this node.
boolean addNode = (numOfChildren > 0 || (discardEmptyNodes && hasDisplayableValuesConfigured && hasDisplayableUserValues) || (!discardEmptyNodes && hasDisplayableValuesConfigured));
if (!addNode) {
data.remove(assessmentNodeData);
return 0;
}
// add itself
return numOfChildren + 1;
}
use of org.olat.course.run.scoring.AssessmentEvaluation in project OpenOLAT by OpenOLAT.
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 PortfolioServiceImpl method getAssessmentStatus.
@Override
public AssessmentEntryStatus getAssessmentStatus(Identity assessedIdentity, BinderRef binderRef) {
Binder binder = binderDao.loadByKey(binderRef.getKey());
RepositoryEntry entry = binder.getEntry();
AssessmentEntryStatus status = null;
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);
status = eval.getAssessmentStatus();
}
} else {
OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
status = assessmentEntry.getAssessmentStatus();
}
return status;
}
Aggregations