Well, after investigating this myself, I found out this "feature" depends on the field the items are sorted on. If I sort by item_id:s, then the code works, if I sort by for instance a related item field, the duplicates appear. Nothing I can do about it in my code, and seems very much like a Podio bug. I have an open support case about this (#114846) if someone from Podio would like to look into this with me.
PodioItem::filter_by_view for current view returns random amount of duplicate item ids
We have developed an extension of sorts and I noticed a strange issue with it. Our extension takes the users current view's items and does something to all of them. However, when the item count becomes larger (a few thousand), the item count doesn't seem to match the source view's count. Investigating further, I found out that random(!) amount of the itemid's returned are duplicates of each other.
I've tried to narrow the problem, but can't place it anywhere else than for this app, the returned itemids from the API include the duplicates. This happens in two apps - both our production version and my test environment which are clones of each other. Then I made another test environment with simpler item structure (only two fields, id and a category to filter on).. and ta-dah, the same PHP code here works correctly, no duplicate itemids!
Has anyone seen this kind of behavior? What could cause this?
Here is output from my testcode, when I repeatedly run this for the same "last view":
Count of items:4881 count of unique: 3932
Count of items:4881 count of unique: 4806
Count of items:4881 count of unique: 4762
I could consider pastebinning my code, but since the same code works towards another app, it seems unlikely.
Please sign in to leave a comment.