Skip to content

Commit

Permalink
Merge pull request sakaiproject#407 from ottenhoff/SAM-2541
Browse files Browse the repository at this point in the history
SAM-2541 use agentId passed instead of looking up current user logged in
  • Loading branch information
ottenhoff committed Apr 17, 2015
2 parents 97d008f + 9dfb642 commit 3799a6a
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2146,7 +2146,7 @@ public ArrayList getBasicInfoOfLastOrHighestOrAverageSubmittedAssessmentsByScori
final String agentId, final String siteId, boolean allAssessments) {

// take account of group release
final ArrayList groupIds = getSiteGroupIdsForCurrentUser(siteId);
final ArrayList<String> groupIds = getSiteGroupIdsForSubmittingAgent(agentId, siteId);
// sorted by submittedData DESC
final String order_last = " order by p.publishedAssessmentId DESC, a.submittedDate DESC";
// sorted by finalScore DESC
Expand Down Expand Up @@ -2656,17 +2656,17 @@ public void setSiteService(SiteService siteService) {
this.siteService = siteService;
}

private ArrayList getSiteGroupIdsForSubmittingAgent(String agentId, String siteId) {
private ArrayList<String> getSiteGroupIdsForSubmittingAgent(String agentId, String siteId) {

final ArrayList<String> groupIds = new ArrayList<String>();
// To accomodate the problem with Hibernate and empty array parameters
// To accommodate the problem with Hibernate and empty array parameters
// TODO: this should probably be handled in a more efficient way
groupIds.add("none");

if (siteId == null)
return groupIds;

Collection siteGroups = null;
Collection<Group> siteGroups = null;

try {
Site s = siteService.getSite(siteId);
Expand All @@ -2679,17 +2679,17 @@ private ArrayList getSiteGroupIdsForSubmittingAgent(String agentId, String siteI
}

if (siteGroups != null) {
Iterator groupsIter = siteGroups.iterator();
Iterator<Group> groupsIter = siteGroups.iterator();

while (groupsIter.hasNext()) {
Group group = (Group) groupsIter.next();
Group group = groupsIter.next();
groupIds.add(group.getId());
}
}
return groupIds;
}

private ArrayList getSiteGroupIdsForCurrentUser(final String siteId) {
private ArrayList<String> getSiteGroupIdsForCurrentUser(final String siteId) {
String currentUserId = UserDirectoryService.getCurrentUser().getId();
return getSiteGroupIdsForSubmittingAgent(currentUserId, siteId);
}
Expand Down

0 comments on commit 3799a6a

Please sign in to comment.