| Project: | Nodequeue |
| Version: | 6.x-2.4 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | dww |
| Status: | closed (fixed) |
Issue Summary
Hello,
I am not sure where the problem lies....
- When I have a filter on the view set to:
"Queue is none of Audit #61: Done"
The some of my nodes appear duplicated in the view. I expected to see one of each of these nodes, as they were not in the done queue.
- If I change the filter to:
"Queue is none of Audit #61: Saved for later"
The I see exactly one of each of the nodes that where previous duplicated. I expected to see none of these nodes as they appear in this queue.
- If I remove the rule, then everything works as expected. I see exactly one of every node.
The obvious thing (at least for points 1 & 2) is if I had two duplicate nodes with the same title, but I have checked and both nodes in point 1 have the same URL and same node ID. I have also checked for other nodes with the same title and not found any.
This only seems to happen with two of my nodes, I am not sure why they are special.
Thanks.
Comments
#1
I assume those nodes are in multiple queues.
Try adding the "Node: Distinct" filter. Re-open this if the distinct filter doesn't fix the issue.
#2
The problem only occurs when I have the node in multiple queues at the same time.
This problem might be in Node Queue, however as I am not sure how the code is split between the two modules for filtering, I will leave this report on Views.
#3
Looks like we replied at the same time. I will try what you suggested, thanks.
#4
While distinct node solves (1), it does not solve (2). That is, if a node appears in two queues, and only want to display nodes that don't appear in one of the queues, then it will still get displayed.
This is counter-intuitive and seems wrong.
#5
It is counterintuitive and seems wrong but that's the way of SQL; it can be difficult to do exclusions properly with situations like this; for the same reason that you see the record show up multiple times. It has to do with how the JOINs work.
There are other ways to write the query, but because Views is generating the query, it is hard to get Views to write it the way you need to get the result you're looking for; in short it requires a filter that is *just* for that queue. And that will be a nodequeue request. (Fortunately -- or perhaps UNfortuantely -- I maintain nodequeue as well. That just means I'm spread thin. :P)
#6
This will be a feature request for a new way to filter the nodequeue to allow exclusion to work.
#7
Whoops, this is an even older issue about nodequeue exclusion support... ;)
See my patch http://drupal.org/files/issues/nodequeue_exclusion_filter.patch.txt from http://drupal.org/node/182159 (which I just marked as duplicate):
#8
#9
Referenced patch applied! Thanks!!
#10
#11
The patch nicely solved the problem of not being able to select nodes that are in no queues. It also worked for nodes in one queue. It doesn't solve it for nodes in more than one queue.
With a where clause including
$field IS NULL OR $field != %das the node is in the table more than once it is still included. UNIQUE isn't going to help here as it is selected.
Changing the clause to include
$field IS NULL OR $table.nid NOT IN (SELECT nq2.nid FROM {nodequeue_nodes} nq2 where nq2.qid = %d)will not select the nodes if they are in the queue, no matter if they are in another queue.
I'm not sure if this is the tidiest way of working with the Views API, I haven't found any notes about doing something like this yet. It works, but it seems to be coding in things that should be done with the query constructor - if you capitalize the 'where' it will strip the end.
Patch on DRUPAL-5--2 attached.
#12
Because Drupal 5 still supports MySQL 3.23, we cannot use sub selects to solve this.
#13
Hmm... MySQL 3.23.17 on accepts conditional joins, so it would be possible to trick views into adding a conditional:
// Not in a specific queue.$joininfo = array(
'type' => 'LEFT',
'left' => array(
'table' => 'node',
'field' => 'nid',
),
'right' => array(
'field' => "nid and qid = $value",
),
);
$num = $query->add_table($table, true, 1, $joininfo);
$tablename = $query->get_table_name($table, $num);
$field = "$tablename.$column";
$query->add_where("$field IS NULL");
I just can't visualize a set of WHERE statements on JOINs to recreate the same. Maybe some one else. Or maybe conditionals in JOINs can be done?
#14
THe proper solution was to put the qid in the join.
#15
Automatically closed -- issue fixed for two weeks with no activity.
#16
Did this functionality make it into 6.x? I'm using 6.x-2.4 along with Views 6.x-2.6 and can't see a "NodeQueue: Not in a queue" views filter. I'm able to set up a relationship so that only nodes in a nodequeue are displayed but I'm not able to flip this to only diusplay nodes that do not belong to a queue.
I had a look in code and found the file nodequeue_handler_filter_in_queue.inc which seems to provide this functionality.
Thanks in advance for any help / advice you may be able to provide.
#17
In case someone else comes across this in their search for the nodequeue filter, you have to add a relationship first. (I almost gave up before I dug a little deeper.)
http://drupal.org/node/417522