use of org.olat.core.gui.util.SyntheticUserRequest in project OpenOLAT by OpenOLAT.
the class DailyStatisticUpdateManagerTest method checkStatistics.
private void checkStatistics(ICourse course, CourseNode node, String date) {
RepositoryEntry re = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
StatisticResult updatedResult = dailyStatisticManager.generateStatisticResult(new SyntheticUserRequest(null, Locale.ENGLISH), course, re.getKey());
Map<String, Integer> updatedRootStats = updatedResult.getStatistics(node);
Integer updated_stats_inMemory = getInMemoryStatistics(re, node, date);
Integer updated_stats_today = updatedRootStats.get(date);
Assert.assertEquals(updated_stats_inMemory, updated_stats_today);
}
use of org.olat.core.gui.util.SyntheticUserRequest in project OpenOLAT by OpenOLAT.
the class HourOfDayStatisticUpdateManagerTest method checkStatistics.
private void checkStatistics(ICourse course, CourseNode node, String date) {
RepositoryEntry re = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
StatisticResult updatedResult = hourOfDayStatisticManager.generateStatisticResult(new SyntheticUserRequest(null, Locale.ENGLISH), course, re.getKey());
Map<String, Integer> updatedRootStats = updatedResult.getStatistics(node);
Integer updated_stats_inMemory = getInMemoryStatistics(re, node, date);
Integer updated_stats_today = updatedRootStats.get(date);
Assert.assertEquals(updated_stats_inMemory, updated_stats_today);
}
use of org.olat.core.gui.util.SyntheticUserRequest in project OpenOLAT by OpenOLAT.
the class DayOfWeekStatisticUpdateManagerTest method checkStatistics.
private void checkStatistics(ICourse course, CourseNode node, String date) {
RepositoryEntry re = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
StatisticResult updatedResult = dayOfWeekStatisticManager.generateStatisticResult(new SyntheticUserRequest(null, Locale.ENGLISH), course, re.getKey());
Map<String, Integer> updatedRootStats = updatedResult.getStatistics(node);
Integer updated_stats_inMemory = getInMemoryStatistics(re, node, date);
Integer updated_stats_today = updatedRootStats.get(date);
Assert.assertEquals(updated_stats_inMemory, updated_stats_today);
}
use of org.olat.core.gui.util.SyntheticUserRequest in project OpenOLAT by OpenOLAT.
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.core.gui.util.SyntheticUserRequest 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);
}
Aggregations