TUVoteInfo: generalize Quorum

SQLite does not support native DECIMAL columns, and for that
reason, we had to switch to using Strings that can hold the data
in the case we are using sqlite.

This commit sets the TUVoteInfo model up in a generic way, that
it always converts to string when setting Quorum (OK for DECIMAL)
and always converts to float when getting Quorum.

This way, we can treat TUVoteInfo.Quorum as the same thing
everywhere.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-06-11 21:48:39 -07:00
parent 541c978ac4
commit 8c345a0448
2 changed files with 15 additions and 2 deletions

View file

@ -39,7 +39,7 @@ def test_tu_voteinfo_creation():
assert tu_voteinfo.User == user.Username
assert tu_voteinfo.Submitted == ts
assert tu_voteinfo.End == ts + 5
assert float(tu_voteinfo.Quorum) == 0.5
assert tu_voteinfo.Quorum == 0.5
assert tu_voteinfo.Submitter == user
assert tu_voteinfo.Yes == 0
assert tu_voteinfo.No == 0