Search in sources :

Example 1 with SyntheticUserRequest

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);
}
Also used : SyntheticUserRequest(org.olat.core.gui.util.SyntheticUserRequest) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 2 with SyntheticUserRequest

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);
}
Also used : SyntheticUserRequest(org.olat.core.gui.util.SyntheticUserRequest) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 3 with SyntheticUserRequest

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);
}
Also used : SyntheticUserRequest(org.olat.core.gui.util.SyntheticUserRequest) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 4 with SyntheticUserRequest

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);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) HighScoreRunController(org.olat.course.highscore.ui.HighScoreRunController) SyntheticUserRequest(org.olat.core.gui.util.SyntheticUserRequest) Component(org.olat.core.gui.components.Component)

Example 5 with SyntheticUserRequest

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);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) HighScoreRunController(org.olat.course.highscore.ui.HighScoreRunController) SyntheticUserRequest(org.olat.core.gui.util.SyntheticUserRequest) Component(org.olat.core.gui.components.Component)

Aggregations

SyntheticUserRequest (org.olat.core.gui.util.SyntheticUserRequest)14 RepositoryEntry (org.olat.repository.RepositoryEntry)8 UserRequest (org.olat.core.gui.UserRequest)2 Component (org.olat.core.gui.components.Component)2 HighScoreRunController (org.olat.course.highscore.ui.HighScoreRunController)2 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)2 Buddy (org.olat.instantMessaging.model.Buddy)2