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.
Some how after node that contained a voting get deleted, the voting api tables dont seem to update. After a quick look at the code i couldn't find a Hook_node_delete. Is this normal ?
Comments
Comment #1
ericduran CreditAttribution: ericduran commentedSounds like a bug.
But the hook shouldn't be hook_node_delete.
If anything it'll be an entity delete hook.
Comment #2
silkAdmin CreditAttribution: silkAdmin commentedYes right, so if i want to implement that can i safely delete entries that match my deleted entity ID in the table `votingapi_cache` and `votingapi_vote`?
Comment #3
ericduran CreditAttribution: ericduran commented@silkAdmin the proper way would be to have votingapi delete the votes. This will also allow votingapi to re calculate is caches.
Have a look at the votingapi documentation. Or how we're deleting votes in d6 for the correct votingapi functions.
Comment #4
silkAdmin CreditAttribution: silkAdmin commentedOk thank you Eric, i ll investigate that.
Comment #5
nafmarcus CreditAttribution: nafmarcus commentedI seem to have the same problem. Has this been fixed / resolved?
Here's my scenario:
There is currently 1 vote cast by node #21253 (a review) on the target node #18439 (product).
If we look in the votingapi_vote table, there are 7 entries and in the votingapi_cache table, there is a count value of 7.
Votingapi_votes
218 node 18439 100 percent Overall_Rating 4 1344029019 127.0.0.1
219 node 18439 100 percent Overall_Rating 4 1344029097 127.0.0.1
220 node 18439 100 percent Overall_Rating 4 1344029298 127.0.0.1
221 node 18439 100 percent Overall_Rating 4 1344029340 127.0.0.1
222 node 18439 100 percent Overall_Rating 4 1344029397 127.0.0.1
224 node 18439 100 percent Overall_Rating 4 1344029862 127.0.0.1
225 node 18439 100 percent Overall_Rating 4 1344030417 127.0.0.1
The problem is that I currently only have one review, #21253 that has a vote relating to #18439.
field_data_field_overall_rating
node product_review 0 21253 21255 und 0 100
Firstly, could you possible explain how each entry in the votingapi_vote table knows which node it belong to? The target nid is clear but not the node that cast the vote.
And secondly, any suggestion of how to fix this problem? The vote count is very important to our site.
Comment #6
dbt102 CreditAttribution: dbt102 at BACnet Interest Group - Drupal for BACnet Interest Group - Drupal commentedI'm marking this as fixed,
1. since VotingAPI is now at 7.x-2.12 on 2014-Aug-14, and
2. per comment #3 the proper way to do it is to have votingapi delete the vote, and
3. the last update was is 2012 ... 5 years ago
Thanks for everyone's effort in reporting the issue and explaining the resolution.
Comment #7
dbt102 CreditAttribution: dbt102 at BACnet Interest Group - Drupal for BACnet Interest Group - Drupal commentedComment #8
dbt102 CreditAttribution: dbt102 at BACnet Interest Group - Drupal for BACnet Interest Group - Drupal commented