liquidvotingio / decidim-module-liquidvoting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Override `Proposal#update_votes_count` to fetch the api count

davefrey opened this issue · comments

We've been wondering what to do with this "abandoned" method that refreshes the vote count with the votes found in the association, like this: update_columns(proposal_votes_count: votes.count).

Rather than just log and try to change code to handle other Decidim calls of Proposal#update_votes_count, we should simply retrieve the vote count from the LV api and update the attribute with that. And keep logging the occurrences.

This was we don't need to worry about the calls, they will always result in the count from the system of record being used.

As per discussion on slack, rather than defensively having api calls from the db model, we're going with compiling where the calls are made and then bypass them explicitly