Commit b4cb8403 authored by Daniel Gerhardt's avatar Daniel Gerhardt

Fix NoSuchElementException in group stats endpoint

A NoSuchElementException was thrown when the stats endpoint was
requested for a room w/o any content groups.
parent 87b7e8b0
......@@ -108,7 +108,7 @@ public class RoomController extends AbstractEntityController<Room> {
roomStatistics.setGroupStats(contentGroups.stream()
.map(cg -> new RoomStatistics.ContentGroupStatistics(cg)).collect(Collectors.toList()));
roomStatistics.setContentCount(contentGroups.stream()
.mapToInt(cg -> cg.getContentIds().size()).reduce((a, b) -> a + b).getAsInt());
.mapToInt(cg -> cg.getContentIds().size()).reduce((a, b) -> a + b).orElse(0));
return roomStatistics;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment