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

OO-1268: remove duplicate members from the assessment list

parent ffded1d1
No related branches found
No related tags found
No related merge requests found
...@@ -27,9 +27,11 @@ package org.olat.course.assessment; ...@@ -27,9 +27,11 @@ package org.olat.course.assessment;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringEscapeUtils;
...@@ -674,9 +676,16 @@ public class AssessmentMainController extends MainLayoutBasicController implemen ...@@ -674,9 +676,16 @@ public class AssessmentMainController extends MainLayoutBasicController implemen
private List<Identity> getAllAssessableIdentities() { private List<Identity> getAllAssessableIdentities() {
List<Identity> participants = businessGroupService.getMembers(coachedGroups, GroupRoles.participant.name()); List<Identity> participants = businessGroupService.getMembers(coachedGroups, GroupRoles.participant.name());
Set<Identity> duplicateKiller = new HashSet<>(participants);
if((repoTutor && coachedGroups.isEmpty()) || (callback.mayAssessAllUsers() || callback.mayViewAllUsersAssessments())) { if((repoTutor && coachedGroups.isEmpty()) || (callback.mayAssessAllUsers() || callback.mayViewAllUsersAssessments())) {
List<Identity> courseParticipants = repositoryService.getMembers(re, GroupRoles.participant.name()); List<Identity> courseParticipants = repositoryService.getMembers(re, GroupRoles.participant.name());
participants.addAll(courseParticipants); for(Identity courseParticipant:courseParticipants) {
if(!duplicateKiller.contains(courseParticipant)) {
participants.add(courseParticipant);
duplicateKiller.add(courseParticipant);
}
}
} }
if(callback.mayViewAllUsersAssessments() && participants.size() < 500) { if(callback.mayViewAllUsersAssessments() && participants.size() < 500) {
...@@ -684,7 +693,11 @@ public class AssessmentMainController extends MainLayoutBasicController implemen ...@@ -684,7 +693,11 @@ public class AssessmentMainController extends MainLayoutBasicController implemen
ICourse course = CourseFactory.loadCourse(ores); ICourse course = CourseFactory.loadCourse(ores);
CoursePropertyManager pm = course.getCourseEnvironment().getCoursePropertyManager(); CoursePropertyManager pm = course.getCourseEnvironment().getCoursePropertyManager();
List<Identity> assessedRsers = pm.getAllIdentitiesWithCourseAssessmentData(participants); List<Identity> assessedRsers = pm.getAllIdentitiesWithCourseAssessmentData(participants);
participants.addAll(assessedRsers); for(Identity assessedRser:assessedRsers) {
if(!duplicateKiller.contains(assessedRser)) {
participants.add(assessedRser);
}
}
} }
return participants; return participants;
} }
......
...@@ -101,6 +101,14 @@ public interface RepositoryService { ...@@ -101,6 +101,14 @@ public interface RepositoryService {
*/ */
public List<Long> getAuthors(RepositoryEntryRef re); public List<Long> getAuthors(RepositoryEntryRef re);
/**
* Get the members of the repository entry (the method doesn't
* follow the business groups).
*
* @param re
* @param roles
* @return
*/
public List<Identity> getMembers(RepositoryEntryRef re, String... roles); public List<Identity> getMembers(RepositoryEntryRef re, String... roles);
public List<String> getRoles(Identity identity, RepositoryEntryRef re); public List<String> getRoles(Identity identity, RepositoryEntryRef re);
......
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