mirror of https://github.com/readrops/Readrops.git
Check item remoteId presence with its foreign feedId
This commit is contained in:
parent
9cb3c14e40
commit
65c7141c29
|
@ -25,8 +25,8 @@ public interface ItemDao {
|
|||
@Query("Select case When :guid In (Select guid from Item) Then 'true' else 'false' end")
|
||||
String guidExist(String guid);
|
||||
|
||||
@Query("Select case When :remoteId In (Select remoteId from Item) Then 1 else 0 end")
|
||||
boolean remoteItemExists(int remoteId);
|
||||
@Query("Select case When :remoteId In (Select remoteId from Item) And :feedId In (Select feed_id From Item) Then 1 else 0 end")
|
||||
boolean remoteItemExists(int remoteId, int feedId);
|
||||
|
||||
@Insert
|
||||
long insert(Item item);
|
||||
|
|
|
@ -192,12 +192,14 @@ public class NextNewsRepository extends ARepository {
|
|||
|
||||
for (NextNewsItem nextNewsItem : items) {
|
||||
|
||||
if (!initialSync) {
|
||||
if (database.itemDao().remoteItemExists(nextNewsItem.getId()))
|
||||
Feed feed = database.feedDao().getFeedByRemoteId(nextNewsItem.getFeedId(), account.getId());
|
||||
|
||||
if (!initialSync && feed != null) {
|
||||
|
||||
if (database.itemDao().remoteItemExists(nextNewsItem.getId(), feed.getId()))
|
||||
break;
|
||||
}
|
||||
|
||||
Feed feed = database.feedDao().getFeedByRemoteId(nextNewsItem.getFeedId(), account.getId());
|
||||
Item item = ItemMatcher.nextNewsItemToItem(nextNewsItem, feed);
|
||||
|
||||
item.setReadTime(Utils.readTimeFromString(item.getContent()));
|
||||
|
|
Loading…
Reference in New Issue