Inconsistance in node counting

Created on 12 September 2024, 2 months ago
Updated 19 September 2024, about 2 months ago

Problem/Motivation

I don't understand what is actually being counted in the node reports "Grouped by type" report.

I have a new content type that has one node but when I look at the report it states that there are 81. This node is translated and I do have revisions enabled. However, node revisions delete is active and is set to limit the revisions to 5.

ID Label Total Published Unpublished
2024_frontpage 2024 Frontpage 81 81 0

If I look at the "Grouped by type and language" report I see the following:

2024_frontpage 2024 Frontpage de 1
2024_frontpage 2024 Frontpage en 1
2024_frontpage 2024 Frontpage es 1
2024_frontpage 2024 Frontpage fr 1
2024_frontpage 2024 Frontpage it 1
2024_frontpage 2024 Frontpage ja 1
2024_frontpage 2024 Frontpage ko 1
2024_frontpage 2024 Frontpage pt-br 1
2024_frontpage 2024 Frontpage zh-hans 1

The "Grouped by type and language" report makes sense to me but what is the "Grouped by type" actually counting.

πŸ› Bug report
Status

Needs review

Version

1.5

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States kcolwell

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

Merge Requests

Comments & Activities

  • Issue created by @kcolwell
  • πŸ‡ͺπŸ‡ΈSpain lpeidro Madrid

    Hello @kcolwell,

    I am trying to replicate the results you have shown, but I am unable to do so.

    Both queries are quite simple.

    The first one:

    $query->accessCheck(FALSE)
          ->condition('status', '1')
          ->groupBy('type')
          ->aggregate('nid', 'count', NULL, $alias_count)
          ->execute(); 
    

    This query counts all the published nodes grouped by type.

    The second one:

    $query->accessCheck(FALSE)
          ->currentRevision()
          ->aggregate('nid', 'COUNT', NULL, $alias)
          ->groupBy('langcode')
          ->groupBy('type')
          ->sort('type')
          ->sort('langcode')
          ->execute();
    

    This query does the same but grouped by type and language.

    The only fundamental difference between the two queries is the use of currentRevision().

    There are two possibilities:
    - The currentRevision() method is needed in the first query to avoid counting all revisions, but I am not sure about that.
    - There are 81 active languages on the site.

    I am going to add the currentRevision() flag to the first query for consistency.

    However, how many translations does each node have?

    Thank you very much.

  • Merge request !45Issue #3473833: Added current revision β†’ (Open) created by lpeidro
  • πŸ‡ͺπŸ‡ΈSpain lpeidro Madrid

    Added the "currentRevision" to the first query to unify.

  • Status changed to Needs review about 2 months ago
  • πŸ‡ͺπŸ‡ΈSpain lpeidro Madrid
Production build 0.71.5 2024