When deleting a comment (from within drupal's admin section or using the comment delete link), the ratings are not removed.

Please advise me on how to fix this.

Thanks

Comments

tseven’s picture

It looks like Simple Review only deletes it's own comment record, but not that made by the voting api.

To fix this replace:

    else if (!$vote) {
       simple_review_delete_vote($comment['cid']);
      }
      break;

    case 'delete':
      simple_review_delete_vote($comment->cid);
      break;

with:

    else if (!$vote) {
          $vote = simple_review_get_vote($comment->cid);
          simple_review_delete_vote($comment['cid']);
          votingapi_delete_vote($vote);
          votingapi_recalculate_results('node', $comment->nid);
      }
      break;

    case 'delete':
      $vote = simple_review_get_vote($comment->cid);
      simple_review_delete_vote($comment->cid);
      votingapi_delete_vote($vote);
      votingapi_recalculate_results('node', $comment->nid);
      break;

This will delete the vote records and recalculate the item value to show the update.