diff --git a/src/main/java/org/olat/course/nodes/appointments/manager/AppointmentDAO.java b/src/main/java/org/olat/course/nodes/appointments/manager/AppointmentDAO.java
index f322a28fd3384f3db22ce373d2dc7cfa86be4840..371f068a5d25dab620bbecb03f9e1c3d4f739de0 100644
--- a/src/main/java/org/olat/course/nodes/appointments/manager/AppointmentDAO.java
+++ b/src/main/java/org/olat/course/nodes/appointments/manager/AppointmentDAO.java
@@ -186,9 +186,20 @@ class AppointmentDAO {
 				.map(t -> (Long)t.get(0))
 				.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
 	}
-
-	private Predicate<? super Tuple> filterFreeOnly(boolean freeOnly) {
-		return t -> freeOnly? t.get(2) == null || ((Integer)t.get(2)).intValue() < ((Long)t.get(3)).intValue(): true;
+	
+	private Predicate<Tuple> filterFreeOnly(boolean freeOnly) {
+		return t -> { 
+			if (freeOnly) {
+				// no max participants
+				if (t.get(2) == null) {
+					return true;
+				}
+				Integer maxParticipants = (Integer)t.get(2);
+				Long count = (Long)t.get(3);
+				return count.intValue() < maxParticipants.intValue();
+			}
+			return true; 
+		};
 	}
 	
 	Long loadAppointmentCount(AppointmentSearchParams params) {
diff --git a/src/test/java/org/olat/course/nodes/appointments/manager/AppointmentDAOTest.java b/src/test/java/org/olat/course/nodes/appointments/manager/AppointmentDAOTest.java
index 6ce8cbfad43ebb8f8755560a9aeee9c6beb7e0e1..3a54cc10660fc9c8da0ef24861d59dc027127d0d 100644
--- a/src/test/java/org/olat/course/nodes/appointments/manager/AppointmentDAOTest.java
+++ b/src/test/java/org/olat/course/nodes/appointments/manager/AppointmentDAOTest.java
@@ -276,16 +276,30 @@ public class AppointmentDAOTest extends OlatTestCase {
 		RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
 		Identity identity = JunitTestHelper.createAndPersistIdentityAsUser(random());
 		String subIdent = JunitTestHelper.random();
-		Topic topic1 = topicDao.createTopic(entry, subIdent);
-		Topic topic2 = topicDao.createTopic(entry, subIdent);
-		Appointment appointment11 = sut.createAppointment(topic1);
-		sut.createAppointment(topic1);
-		Appointment appointment21 = sut.createAppointment(topic2);
-		appointment21.setMaxParticipations(1);
-		sut.saveAppointment(appointment21);
-		participationDao.createParticipation(appointment11, identity);
-		participationDao.createParticipation(appointment11, identity);
-		participationDao.createParticipation(appointment21, identity);
+		Topic topic = topicDao.createTopic(entry, subIdent);
+
+		Appointment noLimitNoParticipations = sut.createAppointment(topic);
+		Appointment noLimitWithParticipations = sut.createAppointment(topic);
+		Appointment limitNoParticipations = sut.createAppointment(topic);
+		Appointment limitFull = sut.createAppointment(topic);
+		Appointment limitNotFull = sut.createAppointment(topic);
+		noLimitNoParticipations.setDetails("noLimitNoParticipations");
+		sut.saveAppointment(noLimitNoParticipations);
+		noLimitWithParticipations.setDetails("noLimitWithParticipations");
+		sut.saveAppointment(noLimitWithParticipations);
+		limitNoParticipations.setDetails("limitNoParticipations");
+		limitNoParticipations.setMaxParticipations(2);
+		sut.saveAppointment(limitNoParticipations);
+		limitFull.setDetails("limitFull");
+		limitFull.setMaxParticipations(1);
+		sut.saveAppointment(limitFull);
+		limitNotFull.setDetails("limitNotFull");
+		limitNotFull.setMaxParticipations(3);
+		sut.saveAppointment(limitNotFull);
+		participationDao.createParticipation(noLimitWithParticipations, identity);
+		participationDao.createParticipation(noLimitWithParticipations, identity);
+		participationDao.createParticipation(limitFull, identity);
+		participationDao.createParticipation(limitNotFull, identity);
 		dbInstance.commitAndCloseSession();
 		
 		AppointmentSearchParams params = new AppointmentSearchParams();
@@ -293,10 +307,7 @@ public class AppointmentDAOTest extends OlatTestCase {
 		params.setSubIdent(subIdent);
 		Map<Long, Long> appointmentCountByTopic = sut.loadTopicKeyToAppointmentCount(params, true);
 		
-		SoftAssertions softly = new SoftAssertions();
-		softly.assertThat(appointmentCountByTopic.get(topic1.getKey())).isEqualTo(2);
-		softly.assertThat(appointmentCountByTopic.get(topic2.getKey())).isNull();
-		softly.assertAll();
+		assertThat(appointmentCountByTopic.get(topic.getKey())).isEqualTo(4);
 	}
 	
 	@Test