Fix: Support floating point numbers in settings (Consensus Quorum Threshold)

Changed number type settings parsing from parseInt to parseFloat to
properly handle decimal values. Added step="any" attribute to number
inputs in the frontend when the setting has decimal min/max/default
values.

This ensures that Consensus Quorum Threshold and other floating point
settings (like METRICS_SAMPLING_RATE) can accept and save decimal
values like 0.5, 0.67, etc. instead of being truncated to integers.

- Updated includes/admin/admin-backend/routes/settings.js
- Updated includes/admin/routes/settings.js
- Updated includes/admin/admin-frontend/ui/settings.js
This commit is contained in:
Raven Scott
2025-12-26 21:20:58 -05:00
parent c4fd25c17e
commit 398e042e81
4 changed files with 16 additions and 3 deletions
@@ -229,7 +229,9 @@ async function handleSettingsRoutes(req, res) {
const meta = settingsMetadata[key];
if (meta) {
if (meta.type === 'number') {
const numValue = parseInt(value, 10);
// Use parseFloat to support both integers and floating point numbers
// parseFloat works for integers too (e.g., parseFloat("5") returns 5)
const numValue = parseFloat(value);
if (isNaN(numValue)) {
errors.push(`${meta.label}: must be a number`);
continue;