use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class IQSELFCourseNode method getUserScoreEvaluation.
/**
* @see org.olat.course.nodes.SelfAssessableCourseNode#getUserScoreEvaluation(org.olat.course.run.userview.UserCourseEnvironment)
*/
@Override
public ScoreEvaluation getUserScoreEvaluation(final UserCourseEnvironment userCourseEnv) {
// read score from properties save score, passed and attempts information
ScoreEvaluation scoreEvaluation = null;
RepositoryEntry referencedRepositoryEntry = getReferencedRepositoryEntry();
if (referencedRepositoryEntry != null && OnyxModule.isOnyxTest(getReferencedRepositoryEntry().getOlatResource())) {
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
Identity mySelf = userCourseEnv.getIdentityEnvironment().getIdentity();
Boolean passed = am.getNodePassed(this, mySelf);
Float score = am.getNodeScore(this, mySelf);
Long assessmentID = am.getAssessmentID(this, mySelf);
// <OLATCE-374>
Boolean fullyAssessed = am.getNodeFullyAssessed(this, mySelf);
scoreEvaluation = new ScoreEvaluation(score, passed, fullyAssessed, assessmentID);
// </OLATCE-374>
} else if (referencedRepositoryEntry != null && ImsQTI21Resource.TYPE_NAME.equals(referencedRepositoryEntry.getOlatResource().getResourceableTypeName())) {
RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
Identity assessedIdentity = userCourseEnv.getIdentityEnvironment().getIdentity();
AssessmentTestSession testSession = CoreSpringFactory.getImpl(QTI21Service.class).getLastAssessmentTestSessions(courseEntry, getIdent(), referencedRepositoryEntry, assessedIdentity);
if (testSession != null) {
boolean fullyAssessed = (testSession.getFinishTime() != null || testSession.getTerminationTime() != null);
Float score = testSession.getScore().floatValue();
return new ScoreEvaluation(score, testSession.getPassed(), fullyAssessed, testSession.getKey());
}
} else {
Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
long olatResourceId = userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue();
QTIResultSet qTIResultSet = CoreSpringFactory.getImpl(IQManager.class).getLastResultSet(identity, olatResourceId, this.getIdent());
if (qTIResultSet != null) {
Boolean passed = qTIResultSet.getIsPassed();
Boolean fullyAssessed = qTIResultSet.getFullyAssessed();
scoreEvaluation = new ScoreEvaluation(Float.valueOf(qTIResultSet.getScore()), passed, fullyAssessed, new Long(qTIResultSet.getAssessmentID()));
}
}
return scoreEvaluation;
}
use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class IQTESTCourseNode method pullAssessmentTestSession.
public void pullAssessmentTestSession(AssessmentTestSession session, UserCourseEnvironment assessedUserCourseenv, Identity coachingIdentity, Role by) {
Boolean visibility;
AssessmentEntryStatus assessmentStatus;
if (IQEditController.CORRECTION_MANUAL.equals(getModuleConfiguration().getStringValue(IQEditController.CONFIG_CORRECTION_MODE))) {
assessmentStatus = AssessmentEntryStatus.inReview;
visibility = Boolean.FALSE;
} else {
assessmentStatus = AssessmentEntryStatus.done;
visibility = Boolean.TRUE;
}
ScoreEvaluation sceval = new ScoreEvaluation(session.getScore().floatValue(), session.getPassed(), assessmentStatus, visibility, Boolean.TRUE, 1.0d, AssessmentRunStatus.done, session.getKey());
updateUserScoreEvaluation(sceval, assessedUserCourseenv, coachingIdentity, true, by);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class QTI21AssessmentDetailsController method doUpdateCourseNode.
private void doUpdateCourseNode(AssessmentTestSession session, AssessmentTest assessmentTest) {
Double cutValue = QtiNodesExtractor.extractCutValue(assessmentTest);
ScoreEvaluation scoreEval = courseNode.getUserScoreEvaluation(assessedUserCourseEnv);
BigDecimal finalScore = session.getFinalScore();
Float score = finalScore == null ? null : finalScore.floatValue();
Boolean passed = scoreEval.getPassed();
if (session.getManualScore() != null && finalScore != null && cutValue != null) {
boolean calculated = finalScore.compareTo(BigDecimal.valueOf(cutValue.doubleValue())) >= 0;
passed = Boolean.valueOf(calculated);
}
ScoreEvaluation manualScoreEval = new ScoreEvaluation(score, passed, scoreEval.getAssessmentStatus(), null, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), session.getKey());
courseNode.updateUserScoreEvaluation(manualScoreEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class ScormRunController method doStartPage.
private void doStartPage(UserRequest ureq) {
// push title and learning objectives, only visible on intro page
startPage.contextPut("menuTitle", scormNode.getShortTitle());
startPage.contextPut("displayTitle", scormNode.getLongTitle());
// Adding learning objectives
String learningObj = scormNode.getLearningObjectives();
if (learningObj != null) {
Component learningObjectives = ObjectivesHelper.createLearningObjectivesComponent(learningObj, getLocale());
startPage.put("learningObjectives", learningObjectives);
startPage.contextPut("hasObjectives", Boolean.TRUE);
} else {
startPage.contextPut("hasObjectives", Boolean.FALSE);
}
if (isAssessable) {
ScoreEvaluation scoreEval = scormNode.getUserScoreEvaluation(userCourseEnv);
Float score = scoreEval.getScore();
if (ScormEditController.CONFIG_ASSESSABLE_TYPE_SCORE.equals(assessableType)) {
startPage.contextPut("score", score != null ? AssessmentHelper.getRoundedScore(score) : "0");
}
startPage.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
startPage.contextPut("passed", scoreEval.getPassed());
boolean resultsVisible = scoreEval.getUserVisible() == null || scoreEval.getUserVisible().booleanValue();
startPage.contextPut("resultsVisible", resultsVisible);
if (resultsVisible && scormNode.hasCommentConfigured()) {
StringBuilder comment = Formatter.stripTabsAndReturns(scormNode.getUserUserComment(userCourseEnv));
startPage.contextPut("comment", StringHelper.xssScan(comment));
}
startPage.contextPut("attempts", scormNode.getUserAttempts(userCourseEnv));
if (ureq == null) {
// High score need one
ureq = new SyntheticUserRequest(getIdentity(), getLocale(), userSession);
}
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, scormNode);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
startPage.put("highScore", highScoreComponent);
}
}
startPage.contextPut("isassessable", Boolean.valueOf(isAssessable));
main.setContent(startPage);
}
use of org.olat.course.run.scoring.ScoreEvaluation 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);
}
}
Aggregations