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.
Comment | File | Size | Author |
---|---|---|---|
#27 | 2796313-27.patch | 1.28 KB | mpp |
#7 | duplicate_entities_when-2796313-7.patch | 1.14 KB | jcnventura |
#4 | duplicate_entities_when-2796313-4.patch | 1.01 KB | jcnventura |
Comments
Comment #2
Ddroid_za CreditAttribution: Ddroid_za commentedI can confirm same happens when you use 2 draggable views for the same entity.
The above fix seems to work for entries that was already in the draggableviews_structure table. Adding new content then gets ignored from the view. Maybe it needs a weight before?
Comment #3
jcnventura CreditAttribution: jcnventura at Wunder commentedThe join should be modified to add an extra condition that the base_table view_name be the same as the view being executed.
Comment #4
jcnventura CreditAttribution: jcnventura at Wunder commentedThis fixes the problem in the correct way. It should cover both the case when different entities have the same id, or there are several draggable views for the same entity.
Comment #5
jcnventura CreditAttribution: jcnventura at Wunder commentedJust found out that this extra condition will result in an empty configuration table. Looking at the D7 module, they've used a views join handler with the same conditions. I'm guessing this will require a similar solution (see https://api.drupal.org/api/drupal/core!modules!views!src!Plugin!views!jo...).
Comment #6
jcnventura CreditAttribution: jcnventura at Wunder commentedUpping this to major. The module provides random results in any configuration that where more than 1 draggable view is used.
Comment #7
jcnventura CreditAttribution: jcnventura at Wunder commentedI couldn't find enough info on using a custom join handler (how do you specify you're using one??).
However, I did find info on query substitutions which are what we need here. This moves the condition to the join expression, fixing the problem I mentioned in #5.
Comment #8
adamwhite CreditAttribution: adamwhite at JMR Logics commentedI've tested the patch from #7 on a site and so far, so good. I've got a view of nodes on a page that I've set to use DraggableViews. I've another view (the stock Taxonomy Term view, extended to use DraggableViews) that interacts with the exact same nodes and I can now successfully manipulate items in either view without creating duplicates or anything unexpected. I need to poke around a bit more, but this looks promising.
Comment #9
narendra.rajwar27Still not working for me, for the same entity type it still duplicating entries. If somehow we can use the "view_display" db field of draggable views inside join(like in D7 there is an option to select a "views display to sort" ) to display our sorted content for different-2 display of a view.
Comment #10
jcnventura CreditAttribution: jcnventura at Wunder commented@narendra.rajwar27, I don't get how it is possible you still get a duplicate..
Please note that if your database is "contaminated", the output will still have duplicates. This patch only fixes the display and generation of the view, but it doesn't change the results when you've generated the draggable weights without it.
Comment #11
Ddroid_za CreditAttribution: Ddroid_za commentedI can confirm that the patch works for me, thank you @jcnventura
Comment #12
dotist CreditAttribution: dotist commentedThe patch did not work for me
Comment #13
mroest CreditAttribution: mroest at Ibuildings commentedVerified the patch works for me. However it could be improved to also include the display name in the join condition. If you need different sort orders between your view displays the patch won't work. I worked around this with multiple views.
Comment #14
tunic@dotist, can you elaborate why the patsh didn't work for you? Other users report it's working, may your case is special in some way.
Comment #15
SaytO CreditAttribution: SaytO at Metadrop commentedPatch #7 worked for me.
My particular case was:
When I generate a view as a block and then change to a page, to have the path, in the draggableviews_structure table I saw that there was identical identity_id with 2 different weight and in the view both elements were painted.
Comment #16
jcornuz@gmail.com CreditAttribution: jcornuz@gmail.com commentedI also faced duplicate items in the following case:
2 different views showing pages depending on the pages' taxonomy tags.
Pages that were tagged for twice would appear as duplicate (both when sorting via a custom "order view" or when showing the main view itself)
Patch 7 did the trick to suppress the duplicate entries.
However, this (obviously) doesn't work with the extra "order view" :/
Comment #17
AndyD3287 worked for me too, again an entity referencing multiple taxonomy terms was duplicated in the results. Many thanks jcnventura.
Comment #18
crizPatch #7 fixed the sorting issue for me. But somehow the Global: DraggableViews Weight views field stopped working in my case (used in another view). But not sure it is related.
Comment #19
MLZRPatch #7 dit it for me. I had this problem with multi language. Every node with more language was duplicated. With patch #7 it was OK.
Note: this is listed as a patch for the "8.x-1.x-dev" version but patch #7 dit not patch on this version; but it dit on 8.x-1.0 !! Before I figured that out.. lots waste of time.. so for the next one.. know this :-P patch #7 on version 1.0
And yes, as mentioned above, a sorting set in a view is not working in an onther view.
Thanks,
Marchello
Comment #20
iStryker CreditAttribution: iStryker commentedGuys can you try https://www.drupal.org/files/issues/2767437-n14.patch from #2767437: Allow sort handler to select the view that stored the order and let me know if it solves your problem. This is more of a solution that will get committed.
Comment #21
iStryker CreditAttribution: iStryker commentedExamples of #3 working
code:
mysql snippet from draggableviews_demo (order)
notice the (draggableviews_structure.view_name = 'draggableviews_demo' AND draggableviews_structure.view_display = 'draggableviews_demo_order')
Will leave issue open for now until #2767437: Allow sort handler to select the view that stored the order patch gets an update_hook(), as people will notice the title of this issue if they are having this issue.
Comment #22
hanoiiEDIT: Wrong issue
Comment #23
caspervoogt CreditAttribution: caspervoogt at Plethora commentedhttps://www.drupal.org/files/issues/2767437-n14.patch is the only patch I could get working (and I tried several).
Comment #24
VitaliyB98 CreditAttribution: VitaliyB98 at Internetdevels commented#7 Thanks!
Comment #25
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedshould become
Comment #26
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedComment #27
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedComment #28
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedFixed the coding standards issues wrt the array notation but we should close this issue in favor of https://www.drupal.org/project/draggableviews/issues/2767437.
Comment #29
frederickjhAs @iStryker stated in his comments in his comment #33 on issue 2867159, this issue is a duplicate of #2767437: Allow sort handler to select the view that stored the order and this issue's code is taking the wrong approach to solving this (as it is similar to #2867159: DraggableViews displays multiple node instances when used in multiple views)and will not be committed.
#2767437: Allow sort handler to select the view that stored the order is taking the correct approach to solving this issue.
I have switched to using the patches in #2767437: Allow sort handler to select the view that stored the order and suggest others switch too to test them.
I am therefore closing this as a duplicate.