The current algorithm for tracking live results is not only incorrect, it's actually almost impossible to fix. It currently attempts to keep a record of all decisions and untally an old decision when it is replaced, then tally the new one. Unfortunately, this fails to account for changes in balances between the time an old decision was cast and a new one replaces it. It also does not update the results as the balances which created them change. On the whole, this method of tracking live results is a dead end (but I was planning to replace it anyways).
Instead, I want to tally contests on-demand, tracking enough data to make it reasonably fast to do this. This means keeping an index of all the decisions and balances voting on a contest. Then, when results are needed, I can iterate all balances voting on a contest, and tally up the results with accurate data at a moment's notice. This method of calculating results may be expensive, which reopens the possibility that the server may need to charge for live results.
The current algorithm for tracking live results is not only incorrect, it's actually almost impossible to fix. It currently attempts to keep a record of all decisions and untally an old decision when it is replaced, then tally the new one. Unfortunately, this fails to account for changes in balances between the time an old decision was cast and a new one replaces it. It also does not update the results as the balances which created them change. On the whole, this method of tracking live results is a dead end (but I was planning to replace it anyways).
Instead, I want to tally contests on-demand, tracking enough data to make it reasonably fast to do this. This means keeping an index of all the decisions and balances voting on a contest. Then, when results are needed, I can iterate all balances voting on a contest, and tally up the results with accurate data at a moment's notice. This method of calculating results may be expensive, which reopens the possibility that the server may need to charge for live results.