If I set a view to be distinct and also have an attachment on the view with distinct set, the summary view in the attachment doesn't actually use DISTINCT. This is in line 495 of argument.handlers.inc.

Comments

merlinofchaos’s picture

Status: Active » Fixed

I committed something that ought to fix this; I don't have any good test scenarios tho so I'm not 100% sure.

aclight’s picture

Status: Fixed » Active

In case you don't catch what I mentioned in IRC, here's what I said:

[12:37] shouldn't that be && empty($this->query_>no_distinct) ??
[12:42] merlinofchaos: also, $this->query->distinct is always 0 at that line, even though for the display in question I have both Distinct: Yes under basic settings and reduce duplicates under the argument handler options selected

merlinofchaos’s picture

Status: Active » Fixed

Try THIS version =)

aclight’s picture

Status: Fixed » Active

Nope, that doesn't work either :(

I get the following error message:

Fatal error: Call to a member function get_option() on a non-object in C:\www\port\drupal\sites\all\modules\views\includes\argument.handlers.inc on line 535

Using a debugger, it doesn't look like $this->display exists at this point.

aclight’s picture

Status: Active » Fixed

http://drupal.org/cvs?commit=123183 fixed the typo here. I'm marking this is fixed but haven't yet tested the functionality yet.

aclight’s picture

Status: Fixed » Active

So in the fix you have this line:

if (!$this->view->display_handler->get_option('distinct') && empty($this->query->no_distinct)) {

but it seems to me like we don't want to negate the first test. In other words, it should be

if ($this->view->display_handler->get_option('distinct') && empty($this->query->no_distinct)) {

The later works for me in the particular situation I wish to use this, and seems to make sense from a logical standpoint. Was the '!' a typo or is there some greater logic I'm missing?

merlinofchaos’s picture

Status: Active » Fixed

The ! is a typo; leftover from getting rid of an empty and forgetting that removing the empty() reverses the logical value.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.