vocdoni / dvote-js

Javascript/Typescript library to interact with the Vocdoni Open Stack
GNU General Public License v3.0
13 stars 7 forks source link

Multiple choice results #66

Closed brickpop closed 2 years ago

brickpop commented 2 years ago

The current PR adds support for aggregating multiple choice results.

brickpop commented 2 years ago

I don't think this is doable as you propose. For example, given one question with two choices:

choices: [{ title: { default: "AA" }, value: 0 }, { title: { default: "BB" }, value: 1 }]

Then, no matter what weights "AA" is receiving, its sum would always be 0, as everything would be multipled by 0. Same for BB (always by 1), same for CC (always by 2), etc.

IMO the results matrix is interpreted like:

results: [
  [ 0-points-AAA, 1-points-AAA, 2-points-AAA ],
  [ 0-points-BBB, 1-points-BBB, 2-points-BBB ]
]

As I see it, the value is only relevant on the results for single choice votes, where you copy the value in the vote. For multiple choice, my understanding is that you use the value when voting, and take it as the index on the vote array.

NateWilliams2 commented 2 years ago

ah, good point! in that case everything looks good to me.