From c5676eb084f825a4e6426c69210d558f1f4e60a2 Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 21 Oct 2026 13:31:28 -0500 Subject: [PATCH] fix(likes): select all active blogs, not only self-rebloggers Co-Authored-By: Claude Opus 5.5 --- URLNotesGrabberCORE/DataAccess.cs | 42 +++++++++++++------------------ 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/URLNotesGrabberCORE/DataAccess.cs b/URLNotesGrabberCORE/DataAccess.cs index 50ea16f..a4b236d 100644 --- a/URLNotesGrabberCORE/DataAccess.cs +++ b/URLNotesGrabberCORE/DataAccess.cs @@ -1366,38 +1366,30 @@ namespace URLNotesGrabberCORE } else if (ignoreCooldown) { - // All blogs with notes: backfill-pending OR any refresh-eligible blog, ignore cooldown - sql = @"SELECT B.BlogName, - COALESCE(B.LikesPulled, 0), - COALESCE(B.LikesCursor, 0), - COALESCE(B.LikesNewestTimestamp, 0) - FROM Blogs B - INNER JOIN Notes N ON N.NoteBlogId = B.BlogId - WHERE N.TimeStamp >= 1535778000 - AND N.RootBlogId = B.BlogId - AND B.IsActive = 1" + AndIsActive("Notes", "N", DBPath) + @" - GROUP BY B.BlogName - ORDER BY MIN(N.TimeStamp);"; + // All active blogs, ignore cooldown + sql = @"SELECT BlogName, + COALESCE(LikesPulled, 0), + COALESCE(LikesCursor, 0), + COALESCE(LikesNewestTimestamp, 0) + FROM Blogs + WHERE IsActive = 1 + ORDER BY COALESCE(LikesLastRefreshed, 0), BlogName;"; } else { // Backfill-pending OR refresh-due (past cooldown window) - sql = @"SELECT B.BlogName, - COALESCE(B.LikesPulled, 0), - COALESCE(B.LikesCursor, 0), - COALESCE(B.LikesNewestTimestamp, 0) - FROM Blogs B - INNER JOIN Notes N ON N.NoteBlogId = B.BlogId - WHERE N.TimeStamp >= 1535778000 - AND N.RootBlogId = B.BlogId - AND B.IsActive = 1" + AndIsActive("Notes", "N", DBPath) + @" + sql = @"SELECT BlogName, + COALESCE(LikesPulled, 0), + COALESCE(LikesCursor, 0), + COALESCE(LikesNewestTimestamp, 0) + FROM Blogs + WHERE IsActive = 1 AND ( - B.LikesPulled = 0 - OR COALESCE(B.LikesLastRefreshed, 0) + COALESCE(LikesPulled, 0) = 0 + OR COALESCE(LikesLastRefreshed, 0) < (CAST(strftime('%s','now') AS INTEGER) - (@cooldownDays * 86400)) ) - GROUP BY B.BlogName - ORDER BY MIN(N.TimeStamp);"; + ORDER BY COALESCE(LikesLastRefreshed, 0), BlogName;"; } using (SQLiteCommand command = new SQLiteCommand(sql, connection))