Closed (works as designed)
Project:
Voting API
Version:
5.x-1.5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Mar 2008 at 13:27 UTC
Updated:
9 Jun 2008 at 16:14 UTC
Jump to comment: Most recent file
Comments
Comment #1
greg.harveyUPDATE:
If I change the VotingAPI settings from "Tally results whenever a vote is cast" to "Tally results at cron-time" and run cron then everything is fine. Looks like there is a little bug hiding in the "Tally results whenever a vote is cast".
Comment #2
greg.harveyComment #3
xqi commentedi am having the same problem.
Comment #4
bryanzera commentedThe votingapi_add_vote() function doesn't try to recalculate the cache like it is purported to do.
Here's a patch to make it recalculate on new votes (when Vote tallying is not set to occur on cron-only)
Comment #5
eaton commentedvotingapi_add_vote() isn't purported to do that at all; it exists so that modules can insert specific votes in various combinations, then manually call the votingapi_recalculate_votes() function when they've completed. If we recalculated every time we added ONE vote, complex votes with multiple criteria would thrash the database badly.
Comment #6
greg.harveyWait a second, ignoring the patch may be mis-using a VotingAPI function, you can't set this whole issue to "by design". The original issue is not fixed thus is still an open issue. For clarity, I'll restate the EXISTING and ACTIVE issue:
When VotingAPI settings are set to "Tally results whenever a vote is cast" and you have any votes using axes other than the default, VotingAPI fails to acknowledge and the votingapi_cache table remains empty (results are *never* tallied).
It seems to be a bug. If it was never intended to work, the whole "axes" feature should be removed as an option, but it seems unlikely as it functions fine when the scripts run at cron and anyway, removing axes would seriously limit the API leaving you with one vote per node.
Comment #7
eaton commentedThat's incorrect. The difference is between the broad "votingapi_set_votes()" function, which has less flexibility but automatically handles the full VotingAPI workflow, including vote recalculation, and the "votingapi_add_vote()" function, which offers more control to modules that need it BUT doesn't automatically trigger recalculation.
Modules that use votingapi_add_vote() are implicitly taking on the responsibility of calling votingapi_recalculate_results() when they're done. If they use votingapi_set_votes() instead, it will be handled automatically. I reiterate: this is by design, and the problem is that a module is adding votes one-by-one but never calling votingapi_recalculate_results().
That's why setting it to recalculate on cron worked perfectly -- all that does is look for content that's had votes cast since the last cron run, and calls votingapi_recalculate_results() on them.
Comment #8
greg.harveyOk - thanks for the clarification - back to the Fivestar team then!! =(