> and of course increment the total_votes column.
>
> So the pseudocode for Post::addVote(score) is
> if post exists
> find average_vote and total_votes
> set average_vote to ((average_vote * total_votes) + score) /
> (total_votes + 1)
> set total
Hi everyone, I have Posts that have Votes, and the Vote has a
percentage. Every time a new Vote is added I want to calculate the
average percentage of all Votes of that particular Post and update the
Post average percentage. Besides a custom query I have no idea how to
do this in my model. Anyone