From 83a52030f5220959a3ab385fc28268fdbd3dc3b9 Mon Sep 17 00:00:00 2001 From: _Bastler Date: Tue, 7 Jun 2022 08:29:04 +0200 Subject: [PATCH] add woodpecker.yml --- .woodpecker.yml | 6 ++++++ .../java/de/bstly/board/businesslogic/CommentManager.java | 6 +++--- .../java/de/bstly/board/businesslogic/EntryManager.java | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .woodpecker.yml diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..f56955e --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,6 @@ +# .woodpecker.yml +pipeline: + build: + image: maven:3-jdk-11 + commands: + - mvn clean package -P db-mariadb diff --git a/src/main/java/de/bstly/board/businesslogic/CommentManager.java b/src/main/java/de/bstly/board/businesslogic/CommentManager.java index 1320042..ccc1b65 100644 --- a/src/main/java/de/bstly/board/businesslogic/CommentManager.java +++ b/src/main/java/de/bstly/board/businesslogic/CommentManager.java @@ -90,10 +90,10 @@ public class CommentManager { */ public Page fetchFlagged(int page, int size, boolean asc) { Sort sort = Sort.by(asc ? Order.asc("created") : Order.desc("created")); - JPAQuery query = jpaQueryFactory.selectFrom(qComment).leftJoin(qFlag).on(qComment.id.eq(qFlag.target)) - .where(qFlag.targetType.eq(Types.comment)).groupBy(qFlag.target); + JPAQuery query = jpaQueryFactory.selectFrom(qComment).innerJoin(qFlag).on(qComment.id.eq(qFlag.target)) + .where(qFlag.targetType.eq(Types.comment)).groupBy(qFlag.target).distinct(); - JPAQuery countQuery = query.clone().select(qComment.id.countDistinct()); + JPAQuery countQuery = query.clone().select(qComment.countDistinct()); Long count = countQuery.fetchOne(); diff --git a/src/main/java/de/bstly/board/businesslogic/EntryManager.java b/src/main/java/de/bstly/board/businesslogic/EntryManager.java index 617e8e8..a4e261d 100644 --- a/src/main/java/de/bstly/board/businesslogic/EntryManager.java +++ b/src/main/java/de/bstly/board/businesslogic/EntryManager.java @@ -409,10 +409,10 @@ public class EntryManager { */ public Page fetchFlagged(int page, int size, boolean asc) { Sort sort = Sort.by(asc ? Order.asc("created") : Order.desc("created")); - JPAQuery query = jpaQueryFactory.selectFrom(qEntry).leftJoin(qFlag).on(qEntry.id.eq(qFlag.target)) - .where(qFlag.targetType.eq(Types.entry)).groupBy(qFlag.target); + JPAQuery query = jpaQueryFactory.selectFrom(qEntry).innerJoin(qFlag).on(qEntry.id.eq(qFlag.target)) + .where(qFlag.targetType.eq(Types.entry)).groupBy(qFlag.target).distinct(); - JPAQuery countQuery = query.clone().select(qEntry.id.countDistinct()); + JPAQuery countQuery = query.clone().select(qEntry.countDistinct()); Long count = countQuery.fetchOne();