diff --git a/pgml-dashboard/src/components/inputs/range/mod.rs b/pgml-dashboard/src/components/inputs/range/mod.rs index 551117fe1..533db5ddd 100644 --- a/pgml-dashboard/src/components/inputs/range/mod.rs +++ b/pgml-dashboard/src/components/inputs/range/mod.rs @@ -32,11 +32,11 @@ impl From<&str> for InterpolationType { #[template(path = "inputs/range/template.html")] pub struct Range { color: String, - min: i32, - max: i32, + min: i64, + max: i64, interpolation_type: InterpolationType, target: Target, - initial_value: i32, + initial_value: i64, } impl Range { @@ -56,12 +56,12 @@ impl Range { self } - pub fn min(mut self, min: i32) -> Self { + pub fn min(mut self, min: i64) -> Self { self.min = min; self } - pub fn max(mut self, max: i32) -> Self { + pub fn max(mut self, max: i64) -> Self { self.max = max; self } @@ -76,7 +76,7 @@ impl Range { self } - pub fn initial_value(mut self, initial_value: i32) -> Self { + pub fn initial_value(mut self, initial_value: i64) -> Self { self.initial_value = initial_value; self } diff --git a/pgml-dashboard/src/components/inputs/range/range_controller.js b/pgml-dashboard/src/components/inputs/range/range_controller.js index 6178e6bf1..a2c914ef4 100644 --- a/pgml-dashboard/src/components/inputs/range/range_controller.js +++ b/pgml-dashboard/src/components/inputs/range/range_controller.js @@ -15,7 +15,6 @@ export default class extends Controller { initialize() {} connect() { - // console.log("range connected", this.initialValue) this.rangeTarget.value = this.interpolationTypeValue === "exponential" ? this.exponentialInterpolationSolveX(this.initialValue) @@ -52,7 +51,7 @@ export default class extends Controller { exponentialInterpolation(value) { if (value < 1) { - return 0; + return this.minValue; } let minValue = this.minValue > 1 ? this.minValue : 1; @@ -72,7 +71,6 @@ export default class extends Controller { let numerator = Math.log(value / minValue); let denominator = Math.log(this.maxValue / minValue); let out = (numerator / denominator) * 100; - // console.log(numerator, denominator, out, Number(out.toPrecision(3))) return parseInt(Number(out.toPrecision(3))); } @@ -82,7 +80,6 @@ export default class extends Controller { } linearInterpolationSolveX(value) { - // console.log("linear solve x ", value, this.minValue, this.maxValue) let out = ((value - this.minValue) / (this.maxValue - this.minValue)) * 100; return parseInt(Number(out.toPrecision(3))); } diff --git a/pgml-dashboard/src/components/inputs/range_group_pricing_calc/mod.rs b/pgml-dashboard/src/components/inputs/range_group_pricing_calc/mod.rs index 9cb2dccc3..64b1c6c52 100644 --- a/pgml-dashboard/src/components/inputs/range_group_pricing_calc/mod.rs +++ b/pgml-dashboard/src/components/inputs/range_group_pricing_calc/mod.rs @@ -8,12 +8,12 @@ use sailfish::TemplateOnce; pub struct RangeGroupPricingCalc { interpolation_type: InterpolationType, include_slider: bool, - min: i32, - max: i32, + min: i64, + max: i64, target: StimulusTarget, label: String, name: String, - initial_value: i32, + initial_value: i64, } impl RangeGroupPricingCalc { @@ -40,12 +40,12 @@ impl RangeGroupPricingCalc { self } - pub fn min(mut self, min: i32) -> Self { + pub fn min(mut self, min: i64) -> Self { self.min = min; self } - pub fn max(mut self, max: i32) -> Self { + pub fn max(mut self, max: i64) -> Self { self.max = max; self } @@ -65,7 +65,7 @@ impl RangeGroupPricingCalc { self } - pub fn initial_value(mut self, initial_value: i32) -> Self { + pub fn initial_value(mut self, initial_value: i64) -> Self { self.initial_value = initial_value; self }