Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When a view has the "node: distinct" filter, the node counts on "empty argument" summaries can be wrong (higher than the actual number of corresponding nodes)
The attached patch (against HEAD - could use a 4.7 backport ?) turns count(node.nid)
into count(DISTINCT node.nid)
if the 'node: distinct' filter is set for the view.
Note : There may be a better way to detect the 'node: distinct' filter - the 'array_reduce' method in this patch feels kind of hackish...
Comment | File | Size | Author |
---|---|---|---|
#1 | views_query.inc_2_0.patch | 989 bytes | yched |
views_query.inc_5.patch | 1.59 KB | yched | |
Comments
Comment #1
yched CreditAttribution: yched commentedUpdate - Actually this patch might be better.
Comment #2
yched CreditAttribution: yched commentedComment #3
merlinofchaos CreditAttribution: merlinofchaos commentedHmm. count($primary_fields) seems ok.
Though it may be better to actually create a flag on the query. If it's been set distinct, we can just check, and apply logic at a later point.
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedI applied this as is, though; better to at least get this in and possibly work out the ramifications of distinct on the future.
Comment #5
(not verified) CreditAttribution: commented