Closed JDziurlaj closed 5 years ago
Taking this from the email chain that had comments for documentation here: Herb Question: ¼ is an easy one since it is an exact decimal. What about 1/3 or other fraction that is a continuous decimal. It would have to terminate and not be exact.
John Response: Fractions expressed as numerator/denominator are allowed. The entire expression is expected to be placed into the NumberVotesFraction e.g. { “NumberVotes”: 1 “NumberVotesFraction”: “1/3” }
Herb: Response: OK. I’m good with that.
Support the expression of fractional votes, either as decimal fractions (e.g.
0.25
) or as a rational number (e.g.1/4
)Rationale
This change is suggested to improve support for voting methods that produce fractional values, e.g. RCV and Cumulative voting.
The attributes
CVRContestSelection::TotalNumberVotes
andSelectionPosition::NumberVotes
are typed asInteger
, which makes expressing fractional values impossible.Approach
The approach is driven by the following constraints:
Thus, the existing attributes will remain unchanged. Instead this proposal adds two attributes,
CVRContestSelection::TotalFractionalVotes
andSelectionPosition::FractionalVotes
as aString
type. When represented as XML or JSON, a pattern constraint will be added, as the following regular expression:>= 1
e.g.2/1
)When a decimal numerals are used, they must begin with a decimal separator (e.g. a decimal point)
This is to make conversion easier, for example
1/4
will cast to0.25
in a programming language such asPython
orJavaScript
.I am open to other names for the attributes, so long as they are clear and concise!