mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
move method around
This commit is contained in:
@@ -41,7 +41,6 @@ import com.commafeed.backend.model.Models;
|
||||
import com.commafeed.backend.model.User;
|
||||
import com.commafeed.backend.model.UserSettings.ReadingOrder;
|
||||
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||
import com.google.api.client.util.Maps;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@@ -278,17 +277,6 @@ public class FeedEntryStatusDAO extends GenericDAO<FeedEntryStatus> {
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map between subscriptionId and unread count
|
||||
*/
|
||||
public Map<Long, Long> getUnreadCount(List<FeedSubscription> subscriptions) {
|
||||
Map<Long, Long> map = Maps.newHashMap();
|
||||
for (FeedSubscription sub : subscriptions) {
|
||||
map.put(sub.getId(), getUnreadCount(sub));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private List<FeedEntryStatus> lazyLoadContent(boolean includeContent,
|
||||
List<FeedEntryStatus> results) {
|
||||
if (includeContent) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.commafeed.backend.model.FeedSubscription;
|
||||
import com.commafeed.backend.model.Models;
|
||||
import com.commafeed.backend.model.User;
|
||||
import com.google.api.client.util.Lists;
|
||||
import com.google.api.client.util.Maps;
|
||||
|
||||
public class FeedSubscriptionService {
|
||||
|
||||
@@ -93,7 +94,8 @@ public class FeedSubscriptionService {
|
||||
List<FeedEntry> allEntries = feedEntryDAO.findByFeed(feed, 0,
|
||||
10);
|
||||
for (FeedEntry entry : allEntries) {
|
||||
FeedEntryStatus status = new FeedEntryStatus(user, sub, entry);
|
||||
FeedEntryStatus status = new FeedEntryStatus(user, sub,
|
||||
entry);
|
||||
status.setRead(false);
|
||||
status.setSubscription(sub);
|
||||
statuses.add(status);
|
||||
@@ -114,7 +116,10 @@ public class FeedSubscriptionService {
|
||||
if (map == null) {
|
||||
log.debug("unread count cache miss for {}", Models.getId(user));
|
||||
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(user);
|
||||
map = feedEntryStatusDAO.getUnreadCount(subs);
|
||||
map = Maps.newHashMap();
|
||||
for (FeedSubscription sub : subs) {
|
||||
map.put(sub.getId(), feedEntryStatusDAO.getUnreadCount(sub));
|
||||
}
|
||||
cache.setUnreadCounts(user, map);
|
||||
}
|
||||
return map;
|
||||
|
||||
Reference in New Issue
Block a user