use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.
the class ProjectBrokerCourseNode method getUserLog.
/**
* @see org.olat.course.nodes.AssessableCourseNode#getUserLog(org.olat.course.run.userview.UserCourseEnvironment)
*/
@Override
public String getUserLog(UserCourseEnvironment userCourseEnvironment) {
UserNodeAuditManager am = userCourseEnvironment.getCourseEnvironment().getAuditManager();
String logValue = am.getUserNodeLog(this, userCourseEnvironment.getIdentityEnvironment().getIdentity());
return logValue;
}
use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.
the class MSCourseNodeRunController method exposeUserDataToVC.
private void exposeUserDataToVC(UserRequest ureq) {
AssessmentEntry assessmentEntry = courseNode.getUserAssessmentEntry(userCourseEnv);
if (assessmentEntry == null) {
myContent.contextPut("hasPassedValue", Boolean.FALSE);
myContent.contextPut("passed", Boolean.FALSE);
hasPassed = hasScore = hasComment = false;
} else {
String rawComment = assessmentEntry.getComment();
hasPassed = assessmentEntry.getPassed() != null;
hasScore = assessmentEntry.getScore() != null;
hasComment = courseNode.hasCommentConfigured() && StringHelper.containsNonWhitespace(rawComment);
boolean resultsVisible = overrideUserResultsVisiblity || assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
myContent.contextPut("resultsVisible", resultsVisible);
myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
myContent.contextPut("hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
myContent.contextPut("passed", assessmentEntry.getPassed());
if (resultsVisible) {
if (hasComment) {
StringBuilder comment = Formatter.stripTabsAndReturns(rawComment);
myContent.contextPut("comment", StringHelper.xssScan(comment));
myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
if (courseNode.hasIndividualAsssessmentDocuments()) {
List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
myContent.contextPut("docsMapperUri", mapperUri);
myContent.contextPut("docs", docs);
myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
if (download == null) {
download = new DisplayOrDownloadComponent("", null);
myContent.put("download", download);
}
}
}
}
if (showLog) {
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
myContent.contextPut("log", am.getUserNodeLog(courseNode, userCourseEnv.getIdentityEnvironment().getIdentity()));
}
}
use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.
the class IQRunController method exposeUserTestDataToVC.
private void exposeUserTestDataToVC(UserRequest ureq) {
// config : show score info
Object enableScoreInfoObject = modConfig.get(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
if (enableScoreInfoObject != null) {
myContent.contextPut("enableScoreInfo", enableScoreInfoObject);
} else {
myContent.contextPut("enableScoreInfo", Boolean.TRUE);
}
// configuration data
myContent.contextPut("attemptsConfig", modConfig.get(IQEditController.CONFIG_KEY_ATTEMPTS));
// user data
Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
if (courseNode instanceof PersistentAssessableCourseNode) {
PersistentAssessableCourseNode acn = (PersistentAssessableCourseNode) courseNode;
AssessmentEntry assessmentEntry = acn.getUserAssessmentEntry(userCourseEnv);
if (assessmentEntry == null) {
myContent.contextPut("blockAfterSuccess", Boolean.FALSE);
myContent.contextPut("score", null);
myContent.contextPut("hasPassedValue", Boolean.FALSE);
myContent.contextPut("passed", Boolean.FALSE);
myContent.contextPut("comment", null);
myContent.contextPut("docs", null);
myContent.contextPut("attempts", 0);
} else {
// block if test passed (and config set to check it)
Boolean blockAfterSuccess = modConfig.getBooleanEntry(IQEditController.CONFIG_KEY_BLOCK_AFTER_SUCCESS);
Boolean blocked = Boolean.FALSE;
if (blockAfterSuccess != null && blockAfterSuccess.booleanValue()) {
Boolean passed = assessmentEntry.getPassed();
if (passed != null && passed.booleanValue()) {
blocked = Boolean.TRUE;
}
}
myContent.contextPut("blockAfterSuccess", blocked);
boolean resultsVisible = assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
myContent.contextPut("resultsVisible", resultsVisible);
myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
myContent.contextPut("hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
myContent.contextPut("passed", assessmentEntry.getPassed());
if (resultsVisible) {
if (acn.hasCommentConfigured()) {
StringBuilder comment = Formatter.stripTabsAndReturns(assessmentEntry.getComment());
myContent.contextPut("comment", StringHelper.xssScan(comment));
myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
if (acn.hasIndividualAsssessmentDocuments()) {
List<File> docs = acn.getIndividualAssessmentDocuments(userCourseEnv);
String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
myContent.contextPut("docsMapperUri", mapperUri);
myContent.contextPut("docs", docs);
myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
}
}
myContent.contextPut("attempts", assessmentEntry.getAttempts() == null ? 0 : assessmentEntry.getAttempts());
}
}
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
myContent.contextPut("log", am.getUserNodeLog(courseNode, identity));
exposeResults(ureq);
}
use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.
the class IQTESTCourseNode method getUserLog.
@Override
public String getUserLog(UserCourseEnvironment userCourseEnvironment) {
UserNodeAuditManager am = userCourseEnvironment.getCourseEnvironment().getAuditManager();
Identity mySelf = userCourseEnvironment.getIdentityEnvironment().getIdentity();
return am.getUserNodeLog(this, mySelf);
}
use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.
the class NewCachePersistingAssessmentManager method saveScoreEvaluation.
/**
* @see org.olat.course.assessment.AssessmentManager#saveScoreEvaluation(org.olat.course.nodes.CourseNode, org.olat.core.id.Identity, org.olat.core.id.Identity, org.olat.course.run.scoring.ScoreEvaluation)
*/
public void saveScoreEvaluation(final CourseNode courseNode, final Identity identity, final Identity assessedIdentity, final ScoreEvaluation scoreEvaluation, final UserCourseEnvironment userCourseEnv, final boolean incrementUserAttempts) {
final ICourse course = CourseFactory.loadCourse(ores);
final CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
final RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
// o_clusterREVIEW we could sync on a element finer than course, e.g. the composite course+assessIdentity.
// +: concurrency would be higher
// -: many entries (num of courses * visitors of given course) in the locktable.
// we could also sync on the assessedIdentity.
Long attempts = CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(createOLATResourceableForLocking(assessedIdentity), new SyncerCallback<Long>() {
public Long execute() {
Long attempts = null;
Float score = scoreEvaluation.getScore();
Boolean passed = scoreEvaluation.getPassed();
saveNodeScore(courseNode, assessedIdentity, score, cpm);
saveNodePassed(courseNode, assessedIdentity, passed, cpm);
saveAssessmentID(courseNode, assessedIdentity, scoreEvaluation.getAssessmentID(), cpm);
if (incrementUserAttempts) {
attempts = incrementNodeAttemptsProperty(courseNode, assessedIdentity, cpm);
}
if (courseNode instanceof AssessableCourseNode) {
userCourseEnv.getScoreAccounting().evaluateAll();
// Update users efficiency statement
EfficiencyStatementManager esm = CoreSpringFactory.getImpl(EfficiencyStatementManager.class);
esm.updateUserEfficiencyStatement(userCourseEnv);
}
if (passed != null && passed.booleanValue() && course.getCourseConfig().isAutomaticCertificationEnabled()) {
CertificatesManager certificatesManager = CoreSpringFactory.getImpl(CertificatesManager.class);
if (certificatesManager.isCertificationAllowed(assessedIdentity, courseEntry)) {
CertificateTemplate template = null;
Long templateId = course.getCourseConfig().getCertificateTemplate();
if (templateId != null) {
template = certificatesManager.getTemplateById(templateId);
}
CertificateInfos certificateInfos = new CertificateInfos(assessedIdentity, score, passed);
certificatesManager.generateCertificate(certificateInfos, courseEntry, template, true);
}
}
return attempts;
}
});
// node log
UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager();
am.appendToUserNodeLog(courseNode, identity, assessedIdentity, SCORE + " set to: " + String.valueOf(scoreEvaluation.getScore()));
if (scoreEvaluation.getPassed() != null) {
am.appendToUserNodeLog(courseNode, identity, assessedIdentity, PASSED + " set to: " + scoreEvaluation.getPassed().toString());
} else {
am.appendToUserNodeLog(courseNode, identity, assessedIdentity, PASSED + " set to \"undefined\"");
}
if (scoreEvaluation.getAssessmentID() != null) {
am.appendToUserNodeLog(courseNode, assessedIdentity, assessedIdentity, ASSESSMENT_ID + " set to: " + scoreEvaluation.getAssessmentID().toString());
}
// notify about changes
AssessmentChangedEvent ace = new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_SCORE_EVAL_CHANGED, assessedIdentity);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ace, course);
// user activity logging
if (scoreEvaluation.getScore() != null) {
ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_SCORE_UPDATED, getClass(), LoggingResourceable.wrap(assessedIdentity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiScore, "", String.valueOf(scoreEvaluation.getScore())));
}
if (scoreEvaluation.getPassed() != null) {
ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_PASSED_UPDATED, getClass(), LoggingResourceable.wrap(assessedIdentity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiPassed, "", String.valueOf(scoreEvaluation.getPassed())));
} else {
ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_PASSED_UPDATED, getClass(), LoggingResourceable.wrap(assessedIdentity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiPassed, "", "undefined"));
}
if (incrementUserAttempts && attempts != null) {
ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_ATTEMPTS_UPDATED, getClass(), LoggingResourceable.wrap(identity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiAttempts, "", String.valueOf(attempts)));
}
}
Aggregations