diff --git a/src/main/java/org/olat/course/run/preview/PreviewRunController.java b/src/main/java/org/olat/course/run/preview/PreviewRunController.java index 18bcbaf855e3d3fd0839ca50edb47359e8622ba1..acb7e932b14f3f42a7467b33b52bb2cb460eb547 100644 --- a/src/main/java/org/olat/course/run/preview/PreviewRunController.java +++ b/src/main/java/org/olat/course/run/preview/PreviewRunController.java @@ -53,6 +53,8 @@ import org.olat.course.run.RunMainController; import org.olat.course.run.environment.CourseEnvironment; import org.olat.course.run.navigation.NavigationHandler; import org.olat.course.run.navigation.NodeClickedRef; +import org.olat.course.run.scoring.NoEvaluationAccounting; +import org.olat.course.run.scoring.ScoreAccounting; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.run.userview.UserCourseEnvironmentImpl; import org.olat.group.BusinessGroup; @@ -92,8 +94,9 @@ public class PreviewRunController extends MainLayoutBasicController { luTree = new MenuTree(null, "luTreeRun", this); luTree.setScrollTopOnClick(true); - // build up the running structure for this user; - uce = new UserCourseEnvironmentImpl(identEnv, cenv); + // build up the running structure for this user + ScoreAccounting noScoreAccounting = new NoEvaluationAccounting(); + uce = new UserCourseEnvironmentImpl(identEnv, cenv, noScoreAccounting); navHandler = new NavigationHandler(uce, null, true); // evaluate scoring @@ -149,11 +152,7 @@ public class PreviewRunController extends MainLayoutBasicController { } return sb.toString(); } - - /** - * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, - * org.olat.core.gui.components.Component, org.olat.core.gui.control.Event) - */ + @Override public void event(UserRequest ureq, Component source, Event event) { if (source == luTree) { @@ -206,10 +205,7 @@ public class PreviewRunController extends MainLayoutBasicController { } } - /** - * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, - * org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event) - */ + @Override public void event(UserRequest ureq, Controller source, Event event) { if (source == currentNodeController) { @@ -266,9 +262,6 @@ public class PreviewRunController extends MainLayoutBasicController { return true; } - /** - * @see org.olat.core.gui.control.DefaultController#doDispose(boolean) - */ @Override protected void doDispose() { if (currentNodeController != null) { diff --git a/src/main/java/org/olat/course/run/userview/UserCourseEnvironmentImpl.java b/src/main/java/org/olat/course/run/userview/UserCourseEnvironmentImpl.java index fa952b9edba7c2dbf260e61942e8772b362300f9..bf905bc81e75759d343cae970f0d29e9cc76302b 100644 --- a/src/main/java/org/olat/course/run/userview/UserCourseEnvironmentImpl.java +++ b/src/main/java/org/olat/course/run/userview/UserCourseEnvironmentImpl.java @@ -84,6 +84,18 @@ public class UserCourseEnvironmentImpl implements UserCourseEnvironment { courseReadOnly = courseEnvironment.getCourseGroupManager().getCourseEntry().getEntryStatus() == RepositoryEntryStatusEnum.closed; } } + + /** + * Constructor used for previewing the course. + * + * @param identityEnvironment The identity environment + * @param courseEnvironment The course environment + * @param scoreAccounting Fix the score accounting implementation + */ + public UserCourseEnvironmentImpl(IdentityEnvironment identityEnvironment, CourseEnvironment courseEnvironment, ScoreAccounting scoreAccounting) { + this(identityEnvironment, courseEnvironment, null, null, null, null, null, null, null, null); + this.scoreAccounting = scoreAccounting; + } public UserCourseEnvironmentImpl(IdentityEnvironment identityEnvironment, CourseEnvironment courseEnvironment, Boolean courseReadOnly) { this(identityEnvironment, courseEnvironment, null, null, null, null, null, null, null, courseReadOnly); @@ -161,7 +173,7 @@ public class UserCourseEnvironmentImpl implements UserCourseEnvironment { } private void initScoreAccounting() { - scoreAccounting = isParticipant()? new AssessmentAccounting(this): new NoEvaluationAccounting(); + scoreAccounting = isParticipant() ? new AssessmentAccounting(this): new NoEvaluationAccounting(); } @Override