From 6ec4f62c81b56b54450004f594747497f511bfb9 Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Wed, 11 Jan 2012 13:34:59 +0100 Subject: [PATCH] OO-49: fix number of person in course and update of this number while browsing the course --- .../java/org/olat/course/run/RunMainController.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/olat/course/run/RunMainController.java b/src/main/java/org/olat/course/run/RunMainController.java index 96d63d57661..12528c4158b 100644 --- a/src/main/java/org/olat/course/run/RunMainController.java +++ b/src/main/java/org/olat/course/run/RunMainController.java @@ -657,11 +657,13 @@ public class RunMainController extends MainLayoutBasicController implements Gene } //re set current user count but not every click - if (currentUserCountLink != null && event.hashCode() % 2 == 0) { + if (currentUserCountLink != null) { OLATResourceable courseRunOres = OresHelper.createOLATResourceableInstance(RunMainController.ORES_TYPE_COURSE_RUN, course.getResourceableId()); int cUsers = CoordinatorManager.getInstance().getCoordinator().getEventBus().getListeningIdentityCntFor(courseRunOres); - if (cUsers == 0) cUsers = 1; - currentUserCountLink.setCustomDisplayText(" "+String.valueOf(cUsers)+" "+getTranslator().translate("participants.in.course")); + if (cUsers == 0) { + cUsers = 1; + } + currentUserCountLink.setCustomDisplayText(getTranslator().translate("participants.in.course", new String[]{ String.valueOf(cUsers) })); currentUserCountLink.setEnabled(false); } } @@ -1277,7 +1279,10 @@ public class RunMainController extends MainLayoutBasicController implements Gene return; } - currentUserCount = 1 + CoordinatorManager.getInstance().getCoordinator().getEventBus().getListeningIdentityCntFor(courseRunOres); + currentUserCount = CoordinatorManager.getInstance().getCoordinator().getEventBus().getListeningIdentityCntFor(courseRunOres); + if(currentUserCount == 0) { + currentUserCount = 1; + } currentUserCountLink.setCustomDisplayText( translate( -- GitLab