I tried creating multiple draggable views that include Taxonomy terms. When multiple draggable views are created, duplicate entries are shown in the results.
Steps to replicate:
1. Create 2 Taxonomy terms (Tax 1 and Tax2)
2. Create content nodes
--- 2.1 Create Video 1 - with Tax 1 & Tax2 as selected taxonomies
--- 2.2 Create Video 2 - with Tax 2 as selected taxonomy
3. Create view (T1View) that will show Tax 1 entries using DraggableViews - everything works at this point
4. Create view (T2View) that will show Tax 2 entries using DraggableViews
5. Go to the both views, change order several times and save both of them - everything breaks at this point
6. Both views (T1View & T2View) are showing Video 2 two times in the list
Comment | File | Size | Author |
---|---|---|---|
#51 | draggableviews_displays-2867159-51.patch | 713 bytes | joco_sp |
#41 | draggableviews_displays.03-8.x-1.2.patch | 921 bytes | chrisrikli |
#40 | draggableviews_displays.02-8.x-1.2.patch | 353 bytes | chrisrikli |
Comments
Comment #2
pawel_r CreditAttribution: pawel_r commentedI have similar issue. Not using taxonomies but problem is the same. It's not 'aggregation' nor 'distinct' issue.
It's shown up suddenly after 2 months of acting properly only in view (of >20 using Views with draggable weight ordering).
EDIT:
I had to add 'relationship' to sort criteria with 'draggable views weight'. For this particular example it helped, but relationship not always can be used in given project.
Comment #3
markovicyu CreditAttribution: markovicyu commented@pawel_r - How do you add 'relationship' to sort criteria with 'draggable views weight'?
Thanks!
Comment #4
pawel_r CreditAttribution: pawel_r commented@markovicyu
Advanced -> Relationships -> add
When you have realationship you will be able to use it with sort criteria.
Comment #5
shaalI have draggableviews installed on 8.2
simple team members page, one content type, no taxonomies.
it worked well, but after changing the order several times, i started seeing double content.
checking closer what's going on, i found that draggableviews weight has multiple instances for the same weight .
i couldn't 'reset' the multiple instances, and from that point on, every time i re-order the list, more duplicate weights are created.
when i uninstalled draggableviews and created the view again, it worked as it should.
unfortunately, i couldn't figure out the steps required to reproduce the bug.
would it be helpful to submit an export of that faulty view?
I would love to help getting this fixed.
Comment #6
harrick CreditAttribution: harrick commented@shaal
I experienced the same issue with multiple views. See my comment from in the Port to Drupal 8 issue. I attempted to fix it myself but couldn't so resorted to adding hidden date fields to determine order. Not ideal but a quick fix until this gets sorted.
Comment #7
webcultist CreditAttribution: webcultist commentedSame problem with double entries here -.-
Comment #8
shaalThe way I 'fixed' it, temporarily -
Now there are no duplicate 'weights' for the same item, so it appears as it should without duplicate entries.
Comment #9
frederickjhBe careful if you use shaal's method to clear the duplicate weights. If you have views that have Draggable View displays they will be removed when you uninstall DraggableViews module. And I mean the whole View will be removed not just the Views display that is a Draggable View.
I backup my view using configuration management so I was able to restore.
I am still getting duplicates. I have two draggable Views displays in two different Views that have a piece of content that is in both. They are filtered on two different fields in their Views.
When I move the piece of content that is in both views I end up with a duplicate. I never have more than two. I think that this is because one is related to one view and the other to the other view but the draggable views filter for some reason does not filter correctly.
If I drag a piece of content that is only in one draggable View I do not get a duplicate.
Comment #10
frederickjhI just realize that I had actually two pieces of content that were in both views. When I reorder only one of them I ended up with duplicates of both. So it looks like if you have content in two (and possibly more) Draggableviews displays you will end up with a duplicate for each display it is in after the first.
Comment #11
frederickjhI tried reducing my Draggable View to a minimum using the instructions found here.
So, reduced the view to:
Fields:
Filter Criteria:
Sort Criteria:
The duplicates still came after moving content in both Draggable Views where the same content was present so that the weight on the content in both views changed.
I removed the DraggableViews Weight from the View and the duplicates were gone. My analysis of this is that the DraggableViews Weight sort is not honoring the Filter Criteria but is instead looking if a draggable view weight is present in the database table and the returning the content to the view based on that.
It is like the Filter Criteria has been somehow skipped or disconnected from the output of the sort Criteria.
I did not look at the database and am assuming that there is a way to differentiate between which draggable view set the weight and which other Views displays are in the same view and using that sort filter.
This is broken. At this point for my use I do not think it is an issue as I do not expect that on the website that one piece content will be in multiple views at one time.
Comment #12
n3or CreditAttribution: n3or commentedBased on https://www.drupal.org/node/2796313 I fixed the problem by adding the view and the display name as conditions within the join.
The draggableviews_structure table may have duplicated values in entity_id, they become unique by adding a view_name and view_display condition. This condition is in the original implementation missing.
Comment #13
n3or CreditAttribution: n3or commentedComment #14
webcultist CreditAttribution: webcultist commentedTried the patch and it works like a charm!!!!
Nice and thanks!!!
Comment #15
webcultist CreditAttribution: webcultist commentedComment #16
Jeff Veit CreditAttribution: Jeff Veit commentedI think there may be a problem with the patch in 13.
Sometimes you want the action of ordering a display to be on that display. For this use case, the patch works for me.
Other times - say when the display you are ordering is paged, or when it only shows the first few items out of hundreds, or when you want to display to the visitors in something which isn't a table (a grid perhaps) - you need one display which shows what the visitor sees, and another which lets the administrator order the items.
In the latter case, the patch breaks things. I think it's because the display names will be different - so you are ordering one display, but the order shown is built using a different display name.
From the UI point of view, I reckon the fix is to include the name of the display to be used for ordering. I see it as fitting in the Sort Criteria element for Draggable.
Comment #17
Jeff Veit CreditAttribution: Jeff Veit commentedComment #18
filburt CreditAttribution: filburt commented#16 is a good point. If you have a separate display for sorting you should not distinguish between displays, because in this case only the sorting display itself will be sorted.
In my case it was enough to remove line 14 and the View display part of line 27 at the patch in #13 and the patch works like a charm (Thanks to n3or for solving my problem after 2 days of work :-) )
Cheers,
Filburt
Comment #19
james.bcn CreditAttribution: james.bcn commentedI have also had this issue - had to uninstall and reinstall the module, then reset everything back to how it was.
Comment #20
frederickjh@filburt then consider submitting a patch and and interdiff.
Comment #21
n3or CreditAttribution: n3or commented@frederickjh: I created a patch and interdiff according to the hint of @filburt. Thanks for your help.
Comment #22
n3or CreditAttribution: n3or commentedComment #23
brtamas CreditAttribution: brtamas at Integral Vision Ltd commentedIt is the same solution, but only it worked for me.
Comment #24
plopescRe-rolling #23 to apply against latest -dev version
Comment #25
frederickjhThe patch in #21 is working for me. Not sure why the patch in #23 needs the hook_preprocess_views_view_table() implementation. Anyone care to explain why?
Comment #26
thejimbirch CreditAttribution: thejimbirch commentedThe patch in #23 on the latest dev solves the problem for me.
I had a single view with a Block and a Draggable view block sorting a simple content type.
I added a second view, which had a Taxonomy Term as a filter on the same content type with a block and a Draggable view block.
After saving both views had two of each result.
I updated to the latest dev, applied the patch, cleared the cache and both view now only list one result as they should.
Comment #27
colinlordJust wanted to add that this patch in #23 also solves this issue for me. Thank you!
Comment #28
Naitschi CreditAttribution: Naitschi commentedHey guys,
I have the same issue mentioned in #16.
I tried all patches #21,#23 and 24# nothing worked. The sortview always shows duplicated entries and my view for showing is not sorted as the draggable weight.
I did everything that is mentioned here (latest dev version, apply patch). Also every step from the Documentation.
I'm working with drupal 8.4 maybe there is the problem?!
Comment #29
bailey86 CreditAttribution: bailey86 commentedhttps://www.drupal.org/u/seba_dru
Did you uninstall and reinstall the draggableviews module? If you didn't then the sort records might still be in the database.
Comment #30
stefanos.petrakis@gmail.comRerolling #24 against latest dev.
Additionally, providing a version of the patch for the current stable (8.x-1.0).
Comment #31
bisonbleu CreditAttribution: bisonbleu commentedJust ran into this issue (draggableviews duplicates), D8.5.1 (8.x-10). Patch in #30 works. Many thanks all!
Comment #32
frederickjhI find it interesting that an user usability issue like this can hang around in the issue queue for over a year. It has several working patches that fix it but we still have yet to see even one comment by any one of the five maintainers of the draggableviews module.
Comment #33
iStryker CreditAttribution: iStryker commented#1, I am pretty much the only maintainer that is active.
#2, The issue is sitting around because we want to fix it properly. The method in this issue is not the way to go. The patch is now identical as #2796313: Duplicate entities when 2 different entity types have the same entity_id the method we want to fix it as is with #2767437: Allow sort handler to select the view that stored the order
Comment #34
frederickjhThanks @iStryker!
I appreciate your work on this module and your feedback. Sorry that it seems you are shorthanded now on the project. I did not realize that there were other issues open related to this one.
Would it be a good idea to close this issue and #2796313 and ask users to add any additional feed back on #2767437?
Comment #35
loopy1492 CreditAttribution: loopy1492 commentedI applied the 8.x-1.0.patch and it worked for me. I had to apply it manually, though, for some reason.
Comment #36
stefvanlooveren CreditAttribution: stefvanlooveren as a volunteer commented#30 worked for me, thanks. Quite a big bug imo :).
Comment #37
alex.skrypnyk#30 works, but be aware that it only filters by view name and not by the draggable display. This means that it will still duplicate results as many times as many displays with sorting you have.
Comment #38
chrisrikli CreditAttribution: chrisrikli commentedBe aware that this issue still exists in recently released versions 1.1 and 1.2; I've had to roll back to 1.0.
Comment #39
chrisrikli CreditAttribution: chrisrikli as a volunteer and commentedHere's a patch for 8.x-1.2. It uses identical methodology to the 8.x-1.0 patch so it will have the same issues as mentioned previously.
Comment #40
chrisrikli CreditAttribution: chrisrikli as a volunteer and commentedThe patch in #39 was missing some namespacing.
Comment #41
chrisrikli CreditAttribution: chrisrikli as a volunteer and commentedApologies for the run of posts, I'm having an off morning; this patch should work properly. Please delete / ignore #39/#40.
Comment #42
imclean CreditAttribution: imclean commentedPatches go against dev and there's nothing to be ported yet.
That said, as mentioned in #34, there's a more active issue: #2767437: Allow sort handler to select the view that stored the order
Comment #43
Maffoo CreditAttribution: Maffoo commentedThanks @chrisrikli, #41 worked well for me on 1.2
Comment #44
zanvidmar CreditAttribution: zanvidmar as a volunteer commentedI can also confirm that #41 works. Thank you @chrisrikli!
Comment #45
markdcThis issue cropped up when I added a 2nd draggable view display. Patch 41 fixes it. Thank you.
One condition: pre-patch views that were affected by this bug were still showing some (fewer) duplicate results after the patch. Duplicating the view and making sure it had a different machine name than the original solved the issue for me.
Comment #46
Pascal- CreditAttribution: Pascal- commentedRan into this problem after duplicating an existing view using draggableviews.
Patch in #41 solved it, though I had to remove my duplicate and remake it.
Comment #47
markdcThis works except for one caveat: when an entity shows up in 2 draggable views and you change the weight in one view, it changes the weight in the other view as well.
Comment #48
frederickjhAs @iStryker stated in his comments above in comment #33, 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 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.
Comment #49
mqannehPatch #41 works and fixed the issue by limiting the results to the current view scope.
Comment #50
damondt CreditAttribution: damondt commentedBefore the accepted method for fixing this is completed note that this patch (#41) only adds filtering by view and not display.
Comment #51
joco_sp CreditAttribution: joco_sp commentedIf somebdoy will still need this. The
use Drupal\views\ViewExecutable;
is not needed anymore, but probably you should go and use the patch from the above mentioned duplicated issue.Comment #52
joco_sp CreditAttribution: joco_sp commentedJust a followup. We don't need the patch anymore. Tested on v2.1.1
Comment #53
joshuasosa CreditAttribution: joshuasosa commentedI'm currently getting duplicates due to draggableviews on 2.1.3. Patch #51 doesn't help.
Enabling "Pass Contextual Filters" helps on the display page, but still get duplicates on the ordering page.
Putting the code in from mattschaff/remove_view_duplicates.includes.php works using
$row['#row']->nid
but it's probably not ideal.