The title might not do this justice. Here is the scenario:

  1. A node queue has a 5 node limit.
  2. The node queue is full with 5 nodes in it
  3. The user is looking at the /admin/content/nodequeue/1/view screen
  4. There is an auto complete field at the bottom for selecting a node to add to the queue
  5. Nodes that are already in the queue show up in the autocomplete field
  6. User selects a node that is already in the nodequeue inadvertently and adds it to the queue
  7. The last(first) node in the queue (depending on reverse order setting) will be pushed out of the queue
    • The nodequeue will now NOT be full. There will be only 4 nodes in the queue.

The problem here is that a node that is already in the queue probably should not be available via the autocomplete to add it to the queue again. Running a check on that field, and only returning nodes not already in the queue is probably the solution.

Comments

mcarbone’s picture

Version: 6.x-2.5 » 6.x-2.9

I'm having a similar problem, which is that if you add a node to a queue which already has that node, in the database, it adds two duplicate nodes into the queue, whereas in the UI, it only shows one. Thus, for a 5 item queue, you'll see only 4 items listed in the UI, but in the database you'll see 5 (including the duplicate). The nodequeue listing table will also accurately say the queue is full, even though from the perspective of the drag-and-drop page you only see 4 items. Lastly, things get pushed off unpredictably. I see two solutions for this:

1) Disabling duplicate node adds, either from the autocomplete, as GregoryHeller suggested, or throwing an error; or

2) Allowing duplicate node adds, but then displaying the node twice in the drag-and-drop interface, so it acts as the user expects.

dboulet’s picture

Status: Needs review » Active

Same problem here, this gets to be very confusing for users.

Could we maybe add an option for queues to allow or disallow duplicates, and implement the options from above based on the chosen option?

dboulet’s picture

Status: Active » Needs review
StatusFileSize
new1.21 KB

This patch filters out nodes from the autocomplete results. I don't know if there's a better way to do this, as my way adds an extra db query which can't be great for performance.

mcarbone’s picture

Status: Needs review » Needs work

Works as advertised. However, it's sufficient to use just sqid (subqueue ID's are unique) in the WHERE query there, and that will be fast since it is indexed.

If this is the solution we go with, we should probably create a new ticket to implement option 2 above as a per-nodequeue option ("allow duplicates").

dboulet’s picture

Status: Needs work » Needs review
StatusFileSize
new1.17 KB

Thanks for the review mcarbone, new patch attached.

mcarbone’s picture

Status: Active » Reviewed & tested by the community

Looks good to me. Once the maintainer commits, I'll create a new ticket for option #2.

jiv_e_old’s picture

Same issue:
http://drupal.org/node/1022998
http://drupal.org/node/1062014

I think this solution is not the best. If you would add nodes dynamically via code the problem would still appear. Conseptually it would be right to check for dublicates in nodequeue_subqueue_add function and return an error if needed.

Additionally we could filter out already included nodes from autocomplete field. But I think there's no need to do it.

The basic idea is the same as in http://drupal.org/node/1022998. I'll attach my patch there.

amateescu’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

Closing as a duplicate of #593468: adding the same node more than once to a queue causes bad behavior. Will deal over there with all this node duplication madness :)