I recently removed a lot of nodes with a lot of votes form a test site and discovered that the calculated results from each one of the nodes was still left in the votingapi tables.

What I did was to duplicate the already existing functionality that removes the votes and made it remove the results as well - through votingapi_select_results and votingapi_delete_results.

CommentFileSizeAuthor
plus1_clean_up_votingapi_results.patch540 bytesvoxpelli
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

NancyDru’s picture

How do you know those votes came from P1? See #1010890: Change votingapi tag.

voxpelli’s picture

Does it matter? If the node is gone then all of the results related to that node can be deleted - right?

NancyDru’s picture

Right. Guess I got caught up in those other "unvote" requests. Now that I am corrected, shouldn't all of this be in the VotingApi module?

voxpelli’s picture

I don't think the Voting API cares what it removes - and any way - the votes are already removed using the same criteria - but the results has been forgotten - which the patch fixes :)

NancyDru’s picture

I agree that the results should cleaned up. My question is who should do it. #115322: Delete votes for deleted nodes

voxpelli’s picture

Just speculating here (I should probably look at the code instead - but speculating is easier). The Voting API describes itself as an API for "[...] rating of any content (comments, nodes, users, fish, whatever)" - since we have no hook_fishapi() or hook_whateverapi() the Voting API module can't implement any removal of stuff itself - instead I think it has to delegate that to the modules integrating the Voting API with fish or nodes :)

NancyDru’s picture

Status: Needs review » Patch (to be ported)
NancyDru’s picture

Status: Patch (to be ported) » Fixed

Committed to 6.x-2.x-dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.