From ef313f51eedac844078157b24da3fcce059ccf11 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Mon, 6 Jun 2022 09:40:02 +0200 Subject: KB66 NewsletterSender: Only consider top-level posts. Change-Id: I8a57dbdbad27e01297263b382ce557859d9b462d --- .../mulk/mulkcms2/benki/newsletter/NewsletterSender.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java index c6999fb..b8f2d07 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java @@ -55,12 +55,14 @@ public class NewsletterSender { List> posts = Post.list( - "" - + "SELECT p FROM Post p" - + " JOIN p.targets r" - + " JOIN r.tags tag" - + " WHERE newsletter IS NULL" - + " AND tag = 'world'", + """ + SELECT DISTINCT p FROM Post p + JOIN p.targets r + JOIN r.tags tag + WHERE p.newsletter IS NULL + AND p.scope = 'top_level' + AND tag = 'world' + """, Sort.ascending("date")); Post.fetchTexts(posts); -- cgit v1.2.3