- Issue created by @loze
- Merge request !36Don't save aggregated vote results for fields that do not exist on the entity type β (Open) created by loze
- πΊπΈUnited States loze Los Angeles
This MR checks if the result field is from the voted entity type.
I think it should also check if the field is on the bundle and unset the ones that aren't as well.
- First commit to issue fork.
- πΊπΈUnited States tr Cascadia
So ... that means everyone who is using the 8.x-1.x and 2.0.x versions of this module has a bunch of excess rows. If that's the case, then we also need a
hook_update_N()
function here to clean up the database on existing sites.I changed your MR to use the new object-oriented hooks, since everything else in this module and Voting API has already been changed to OO hooks.
- πΊπΈUnited States loze Los Angeles
Thanks @tr. yes, this has been happening at least since 8.x-1.x.
I will try to write an update hook.
- πΊπΈUnited States loze Los Angeles
Im also wondering if there is a way to not have the rows generated in the first place, eliminating the need to unset them in the alter hook. Possibly by changing the logic in
getDerivativeDefinitions
? I will dig into this some more. - πΊπΈUnited States loze Los Angeles
@td I made a few updates
1. Checked for a few other scenarios where invalid rows were still being written. It should now only write results for valid entity/bundle/field combos.
2. Added an update hook that recalculates the results on all voted entities, which cleans up the results table.I ran it on my local test site where I have thousands of votes of coming from about 10 different fields across 4 entity types and it cleaned everything up!