From 54393000b316ea6fd3c193d286f0981d320b96e5 Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Wed, 16 Oct 2019 14:40:21 +0200 Subject: [PATCH] Fix comment::children_count --- .../resources/sql/functions/comment/find_comments_by_target.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/sql/functions/comment/find_comments_by_target.sql b/src/main/resources/sql/functions/comment/find_comments_by_target.sql index 5204157..3c0b5ed 100644 --- a/src/main/resources/sql/functions/comment/find_comments_by_target.sql +++ b/src/main/resources/sql/functions/comment/find_comments_by_target.sql @@ -12,7 +12,7 @@ begin from ( select com.*, - (select count(*) from "comment" c2 where c2.parents_ids @> array[com.id]) as children_count, + (select count(c2) from "comment" c2 where c2.parent_comment_id = com.id) as children_count, find_reference_by_id(com.target_id, com.target_reference) as target, find_citizen_by_id(com.created_by_id) as created_by, count_vote(com.id) as votes