Skip to content

Commit

Permalink
[1.208.*] Pre-release merge (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramline-github[bot] authored Jul 28, 2024
2 parents 64eece5 + c5c073a commit dc8bdd6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class HomePresenter(
}
}

rssRepository.hasUnreadPosts(
rssRepository.hasUnreadPostsInSource(
sourceId = activeSource?.id,
postsAfter = postsAfter,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,12 @@ class RssRepository(
}
}

fun hasUnreadPosts(sourceId: String?, postsAfter: Instant = Instant.DISTANT_PAST): Flow<Boolean> {
fun hasUnreadPostsInSource(
sourceId: String?,
postsAfter: Instant = Instant.DISTANT_PAST
): Flow<Boolean> {
return postQueries
.unreadPostsCount(sourceId = sourceId, after = postsAfter)
.unreadPostsCountInSource(sourceId = sourceId, after = postsAfter)
.asFlow()
.mapToOne(ioDispatcher)
.map { it > 0 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,14 @@ WHERE post.id = :id;
hasPost:
SELECT EXISTS(SELECT 1 FROM post WHERE id = :id);

unreadPostsCount:
SELECT COUNT(*) FROM post WHERE read != 1 AND date > :after AND (sourceId = :sourceId OR :sourceId IS NULL);
unreadPostsCountInSource:
SELECT COUNT(*) FROM post
LEFT JOIN feedGroup ON INSTR(feedGroup.feedIds, post.sourceId)
WHERE
read != 1 AND
date > :after AND
(
:sourceId IS NULL OR
post.sourceId = :sourceId OR
feedGroup.id = :sourceId
);

0 comments on commit dc8bdd6

Please sign in to comment.