Hi,
the drush vcalc function runs into an error:
Error: Call to undefined function votingapi_recalculate_results() in drush_votingapi_recalculate() (line 172 of /home/
Obviously the function votingapi_recalculate_results() does not exist.
To workaround the issue, I've made advantage of the
plugin.manager.votingapi.resultfunction service through which i can access the function recalculateResults.
I've changed the drush_votingapi_recalculate function (line 154) in votingapi.drush.inc the following way:
foreach ($votes as $vote) {
$manager = Drupal::service('plugin.manager.votingapi.resultfunction');
$manager->recalculateResults($vote['entity_type'], $vote['entity_id'], 'vote');
}
Comments
Comment #2
awroblewski commentedadded patch file
Comment #3
awroblewski commentedA new version of the fix.
vote_type is no longer hard coded and can be supplied as the third parameter to the vcalc drush function.
As well swaped console output, "rebuild all votes" is displayed when all votes are rebuild and for specific vote recalc, the appropriate message is displayed. Both outputs where merely in the wrong if else path.
This is no incremental fix for the one i provided yesterday, so it should be applied to the 8.x-3.x version.
thanks
Comment #4
socialnicheguru commentedComment #5
pifagor commentedPatch Failed to Apply
Comment #6
shubham.prakash commentedThe patch in #3 seems correct to me, added reroll for it.
Comment #7
shubham.prakash commentedComment #8
pifagor commentedComment #9
andralex commentedTested and worked for Drupal version 8.8.2, Drush 8.3.3-dev. But some minor issues found:
I'd say that the message here should be unchanged.
The message here could be changed to 'Rebuilt voting results for @type id: @entity_id.'
Comment #10
andralex commentedHere is an updated patch regarding to my last comment.
Comment #11
alex_optimGood for me.
Comment #12
pifagor commentedNeed to reroll
Comment #14
pifagor commented