use String(max_len) for DECIMAL types with sqlite

This solves an issue where DECIMAL is not native
to sqlite by using a string to store values and
converting them to float in user code.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-06-03 22:56:47 -07:00
parent a65a60604a
commit e5df083d45
2 changed files with 13 additions and 4 deletions

View file

@ -67,8 +67,11 @@ if (has_credential(CRED_TU_ADD_VOTE)) {
}
}
if (!empty($_POST['addVote']) && empty($error)) {
add_tu_proposal($_POST['agenda'], $_POST['user'], $len, $quorum, $uid);
if (!empty($_POST['addVote']) && empty($error)) {
// Convert $quorum to a String of maximum length "12.34" (5).
$quorum_str = substr(strval($quorum), min(5, strlen($quorum));
add_tu_proposal($_POST['agenda'], $_POST['user'],
$len, $quorum_str, $uid);
print "<p class=\"pkgoutput\">" . __("New proposal submitted.") . "</p>\n";
} else {