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
Feature/26194
Costantino Perciante 8 years ago
parent 38ed5f1570
commit 6a848e2bce

@ -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){

Loading…
Cancel
Save