Skip to content

Commit

Permalink
[1.65.*] Pre-release merge (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramline-github[bot] authored Feb 8, 2024
2 parents 12d4f25 + 424b5ea commit ac7ca7d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ class RssRepository(
countQuery =
postQueries.count(
feedLink = selectedFeedLink,
featuredPostsLimit = NUMBER_OF_FEATURED_POSTS
featuredPostsLimit = NUMBER_OF_FEATURED_POSTS,
unreadOnly = unreadOnly,
postsAfter = after,
),
transacter = postQueries,
context = ioDispatcher,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,22 @@ UPDATE SET title = excluded.title, description = excluded.description, rawConten

count:
SELECT COUNT(*) FROM post
WHERE (:feedLink IS NULL OR post.feedLink = :feedLink) AND post.link NOT IN (
SELECT post.link FROM post
WHERE (:feedLink IS NULL OR post.feedLink = :feedLink) AND post.imageUrl IS NOT NULL
ORDER BY post.date DESC LIMIT :featuredPostsLimit
);
WHERE
(:unreadOnly IS NULL OR post.read != :unreadOnly) AND
(:feedLink IS NULL OR post.feedLink = :feedLink) AND
-- Skip featured posts --
post.link NOT IN (
SELECT post.link FROM post
WHERE
(:unreadOnly IS NULL OR post.read != :unreadOnly) AND
(:feedLink IS NULL OR post.feedLink = :feedLink) AND
post.imageUrl IS NOT NULL AND
post.date > :postsAfter
ORDER BY post.date DESC LIMIT :featuredPostsLimit
) AND
-- Skip featured posts --
post.date > :postsAfter
ORDER BY post.date DESC;

featuredPosts:
SELECT
Expand Down Expand Up @@ -71,6 +82,7 @@ INNER JOIN feed ON post.feedLink == feed.link
WHERE
(:unreadOnly IS NULL OR post.read != :unreadOnly) AND
(:feedLink IS NULL OR post.feedLink = :feedLink) AND
-- Skip featured posts --
post.link NOT IN (
SELECT post.link FROM post
WHERE
Expand All @@ -80,6 +92,7 @@ WHERE
post.date > :postsAfter
ORDER BY post.date DESC LIMIT :featuredPostsLimit
) AND
-- Skip featured posts --
post.date > :postsAfter
ORDER BY post.date DESC
LIMIT :limit OFFSET :offset;
Expand Down

0 comments on commit ac7ca7d

Please sign in to comment.