minor fix for user statistics retrieval at server side: first sort the feeds list, then pick elements into the specified range and then enhance them

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@130994 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-08-06 13:55:45 +00:00
parent 38ed5f1570
commit 6a848e2bce
1 changed files with 2 additions and 2 deletions

View File

@ -1194,10 +1194,10 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
}
// enhance retrieved feeds
// sort the list, retrieve elements in the range and enhance the feeds
Collections.sort(feeds, Collections.reverseOrder());
int upperIndex = (from + quantity) >= feeds.size() ? feeds.size() - 1 : from + quantity;
feeds = (ArrayList<Feed>) feeds.subList(from, upperIndex);
Collections.sort(feeds, Collections.reverseOrder());
return enhanceFeeds(feeds, -1);
}catch(Exception e){