Incorrect occurrence counting in drilldown report

Created on 8 March 2024, 4 months ago
Updated 19 March 2024, 3 months ago

Problem/Motivation

I have a paragraph type content_gallery that is used twice in my node 1002. However, the report says there are 8 occurrences.

Executing the query manually for that paragraph type and parent ID, I get this:

+-------+-----------------+--------+-----------+-------------+----------------------+-------------+-----------+
| id    | type            | status | parent_id | parent_type | parent_field_name    | entity_type | is_active |
+-------+-----------------+--------+-----------+-------------+----------------------+-------------+-----------+
| 19193 | content_gallery |      1 | 1002      | node        | field_content_blocks | home_page   | home_page |
| 19193 | content_gallery |      1 | 1002      | node        | field_content_blocks | home_page   | home_page |
| 19193 | content_gallery |      1 | 1002      | node        | field_content_blocks | home_page   | home_page |
| 19193 | content_gallery |      1 | 1002      | node        | field_content_blocks | home_page   | home_page |
| 20935 | content_gallery |      1 | 1002      | node        | field_content_blocks | home_page   | home_page |
| 20935 | content_gallery |      1 | 1002      | node        | field_content_blocks | home_page   | home_page |
| 20935 | content_gallery |      1 | 1002      | node        | field_content_blocks | home_page   | home_page |
| 20935 | content_gallery |      1 | 1002      | node        | field_content_blocks | home_page   | home_page |
+-------+-----------------+--------+-----------+-------------+----------------------+-------------+-----------+
8 rows in set (0.003 sec)

This looks like a prime candidate for using DISTINCT, which solves the problem:

+-------+-----------------+--------+-----------+-------------+----------------------+-------------+-----------+
| id    | type            | status | parent_id | parent_type | parent_field_name    | entity_type | is_active |
+-------+-----------------+--------+-----------+-------------+----------------------+-------------+-----------+
| 19193 | content_gallery |      1 | 1002      | node        | field_content_blocks | home_page   | home_page |
| 20935 | content_gallery |      1 | 1002      | node        | field_content_blocks | home_page   | home_page |
+-------+-----------------+--------+-----------+-------------+----------------------+-------------+-----------+
2 rows in set (0.003 sec)

Proposed resolution

Add DISTINCT to the built query in getSqlBundle.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium beerendlauwers

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024