Fix local items not linked to the right feeds

This commit is contained in:
Shinokuni 2019-08-26 10:35:47 +02:00
parent 5656817dea
commit 959614d99e
2 changed files with 5 additions and 5 deletions

View File

@ -30,8 +30,8 @@ public abstract class FeedDao implements BaseDao<Feed> {
@Query("Select count(*) from Feed Where account_id = :accountId")
public abstract Single<Integer> getFeedCount(int accountId);
@Query("Select * from Feed Where url = :feedUrl")
public abstract Feed getFeedByUrl(String feedUrl);
@Query("Select * from Feed Where url = :feedUrl And account_id = :accountId")
public abstract Feed getFeedByUrl(String feedUrl, int accountId);
@Query("Select id from Feed Where remoteId = :remoteId And account_id = :accountId")
public abstract int getFeedIdByRemoteId(String remoteId, int accountId);

View File

@ -151,15 +151,15 @@ public class LocalFeedRepository extends ARepository<Void> {
switch (type) {
case RSS_2:
dbFeed = database.feedDao().getFeedByUrl(((RSSFeed) feed).getChannel().getFeedUrl());
dbFeed = database.feedDao().getFeedByUrl(((RSSFeed) feed).getChannel().getFeedUrl(), account.getId());
items = ItemMatcher.itemsFromRSS(((RSSFeed) feed).getChannel().getItems(), dbFeed);
break;
case RSS_ATOM:
dbFeed = database.feedDao().getFeedByUrl(((ATOMFeed) feed).getUrl());
dbFeed = database.feedDao().getFeedByUrl(((ATOMFeed) feed).getUrl(), account.getId());
items = ItemMatcher.itemsFromATOM(((ATOMFeed) feed).getEntries(), dbFeed);
break;
case RSS_JSON:
dbFeed = database.feedDao().getFeedByUrl(((JSONFeed) feed).getFeedUrl());
dbFeed = database.feedDao().getFeedByUrl(((JSONFeed) feed).getFeedUrl(), account.getId());
items = ItemMatcher.itemsFromJSON(((JSONFeed) feed).getItems(), dbFeed);
break;
}