From 47497d02bf7d46c151d4756a7ef16f368b79ca02 Mon Sep 17 00:00:00 2001 From: jim Date: Mon, 11 May 2026 09:03:01 -0500 Subject: [PATCH] tweak GetPosts beforeDate filter and broaden GetBlogsForLikes - GetPosts: match NotesGatheredDateTime = 0 instead of IS NULL for the beforeDate cutoff. - GetBlogsForLikes: drop the EXISTS-Posts predicate so blogs with notes but no posts rows are still eligible for likes collection. Co-Authored-By: Claude Opus 4.7 --- URLNotesGrabberCORE/DataAccess.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/URLNotesGrabberCORE/DataAccess.cs b/URLNotesGrabberCORE/DataAccess.cs index 95338f4..7ab83a3 100644 --- a/URLNotesGrabberCORE/DataAccess.cs +++ b/URLNotesGrabberCORE/DataAccess.cs @@ -665,7 +665,7 @@ namespace URLNotesGrabberCORE if (beforeDate.HasValue) { long unixTimestamp = new DateTimeOffset(beforeDate.Value).ToUnixTimeSeconds(); - sql += $" AND (NotesGatheredDateTime < {unixTimestamp} OR NotesGatheredDateTime IS NULL) " + Environment.NewLine; + sql += $" AND (NotesGatheredDateTime < {unixTimestamp} OR NotesGatheredDateTime= 0) " + Environment.NewLine; } sql += "GROUP BY " + Environment.NewLine + @@ -972,7 +972,7 @@ namespace URLNotesGrabberCORE if (!string.IsNullOrEmpty(specificBlog)) sql = "SELECT BlogName, COALESCE(LikesPulled, 0), COALESCE(LikesCursor, 0) FROM Blogs WHERE BlogName = @blog"; else - sql = "SELECT B.BlogName, COALESCE(LikesPulled, 0), COALESCE(LikesCursor, 0) FROM Blogs B INNER JOIN Notes N ON N.NoteBlogName = B.BlogName WHERE B.LikesPulled = 0 AND N.TimeStamp >= 1535778000 AND N.rootBlogName = B.BlogName AND EXISTS (SELECT 1 FROM Posts P WHERE P.BlogName = B.BlogName) GROUP BY B.BlogName ORDER BY MIN(N.Timestamp);"; + sql = "SELECT B.BlogName, COALESCE(LikesPulled, 0), COALESCE(LikesCursor, 0) FROM Blogs B INNER JOIN Notes N ON N.NoteBlogName = B.BlogName WHERE B.LikesPulled = 0 AND N.TimeStamp >= 1535778000 AND N.rootBlogName = B.BlogName GROUP BY B.BlogName ORDER BY MIN(N.Timestamp);"; using (SQLiteCommand command = new SQLiteCommand(sql, connection)) {