Skip to content
Snippets Groups Projects
Commit d28e8b55 authored by srosse's avatar srosse
Browse files

OO-1916: deduplicate the list of resource used to build the aggregated calendar

parent 34f64584
No related branches found
No related tags found
No related merge requests found
...@@ -112,7 +112,14 @@ public class HomeCalendarManager implements PersonalCalendarManager { ...@@ -112,7 +112,14 @@ public class HomeCalendarManager implements PersonalCalendarManager {
SearchBusinessGroupParams groupParams = new SearchBusinessGroupParams(identity, true, true); SearchBusinessGroupParams groupParams = new SearchBusinessGroupParams(identity, true, true);
groupParams.addTools(CollaborationTools.TOOL_CALENDAR); groupParams.addTools(CollaborationTools.TOOL_CALENDAR);
List<BusinessGroup> groups = businessGroupService.findBusinessGroups(groupParams, null, 0, -1); List<BusinessGroup> groups = businessGroupService.findBusinessGroups(groupParams, null, 0, -1);
Set<BusinessGroup> resourceSet = new HashSet<>();
for(BusinessGroup group:groups) { for(BusinessGroup group:groups) {
if(resourceSet.contains(group)) {
continue;
} else {
resourceSet.add(group);
}
String calendarId = group.getKey().toString(); String calendarId = group.getKey().toString();
CalendarKey key = new CalendarKey(calendarId, CalendarManager.TYPE_GROUP); CalendarKey key = new CalendarKey(calendarId, CalendarManager.TYPE_GROUP);
CalendarUserConfiguration calendarConfig = configMap.get(key); CalendarUserConfiguration calendarConfig = configMap.get(key);
...@@ -127,8 +134,15 @@ public class HomeCalendarManager implements PersonalCalendarManager { ...@@ -127,8 +134,15 @@ public class HomeCalendarManager implements PersonalCalendarManager {
if(calendarModule.isEnableCourseElementCalendar() || calendarModule.isEnableCourseToolCalendar()) { if(calendarModule.isEnableCourseElementCalendar() || calendarModule.isEnableCourseToolCalendar()) {
List<Object[]> resources = getCourses(identity); List<Object[]> resources = getCourses(identity);
Set<RepositoryEntry> resourceSet = new HashSet<>();
for(Object[] resource:resources) { for(Object[] resource:resources) {
RepositoryEntry courseEntry = (RepositoryEntry)resource[0]; RepositoryEntry courseEntry = (RepositoryEntry)resource[0];
if(resourceSet.contains(courseEntry)) {
continue;
} else {
resourceSet.add(courseEntry);
}
String calendarId = courseEntry.getOlatResource().getResourceableId().toString(); String calendarId = courseEntry.getOlatResource().getResourceableId().toString();
CalendarKey key = new CalendarKey(calendarId, CalendarManager.TYPE_COURSE); CalendarKey key = new CalendarKey(calendarId, CalendarManager.TYPE_COURSE);
CalendarUserConfiguration calendarConfig = configMap.get(key); CalendarUserConfiguration calendarConfig = configMap.get(key);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment