File tree Expand file tree Collapse file tree 3 files changed +13
-16
lines changed
pgml-dashboard/src/components/inputs Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -32,11 +32,11 @@ impl From<&str> for InterpolationType {
3232#[ template( path = "inputs/range/template.html" ) ]
3333pub struct Range {
3434 color : String ,
35- min : i32 ,
36- max : i32 ,
35+ min : i64 ,
36+ max : i64 ,
3737 interpolation_type : InterpolationType ,
3838 target : Target ,
39- initial_value : i32 ,
39+ initial_value : i64 ,
4040}
4141
4242impl Range {
@@ -56,12 +56,12 @@ impl Range {
5656 self
5757 }
5858
59- pub fn min ( mut self , min : i32 ) -> Self {
59+ pub fn min ( mut self , min : i64 ) -> Self {
6060 self . min = min;
6161 self
6262 }
6363
64- pub fn max ( mut self , max : i32 ) -> Self {
64+ pub fn max ( mut self , max : i64 ) -> Self {
6565 self . max = max;
6666 self
6767 }
@@ -76,7 +76,7 @@ impl Range {
7676 self
7777 }
7878
79- pub fn initial_value ( mut self , initial_value : i32 ) -> Self {
79+ pub fn initial_value ( mut self , initial_value : i64 ) -> Self {
8080 self . initial_value = initial_value;
8181 self
8282 }
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ export default class extends Controller {
1515 initialize ( ) { }
1616
1717 connect ( ) {
18- // console.log("range connected", this.initialValue)
1918 this . rangeTarget . value =
2019 this . interpolationTypeValue === "exponential"
2120 ? this . exponentialInterpolationSolveX ( this . initialValue )
@@ -52,7 +51,7 @@ export default class extends Controller {
5251
5352 exponentialInterpolation ( value ) {
5453 if ( value < 1 ) {
55- return 0 ;
54+ return this . minValue ;
5655 }
5756
5857 let minValue = this . minValue > 1 ? this . minValue : 1 ;
@@ -72,7 +71,6 @@ export default class extends Controller {
7271 let numerator = Math . log ( value / minValue ) ;
7372 let denominator = Math . log ( this . maxValue / minValue ) ;
7473 let out = ( numerator / denominator ) * 100 ;
75- // console.log(numerator, denominator, out, Number(out.toPrecision(3)))
7674 return parseInt ( Number ( out . toPrecision ( 3 ) ) ) ;
7775 }
7876
@@ -82,7 +80,6 @@ export default class extends Controller {
8280 }
8381
8482 linearInterpolationSolveX ( value ) {
85- // console.log("linear solve x ", value, this.minValue, this.maxValue)
8683 let out = ( ( value - this . minValue ) / ( this . maxValue - this . minValue ) ) * 100 ;
8784 return parseInt ( Number ( out . toPrecision ( 3 ) ) ) ;
8885 }
Original file line number Diff line number Diff line change @@ -8,12 +8,12 @@ use sailfish::TemplateOnce;
88pub struct RangeGroupPricingCalc {
99 interpolation_type : InterpolationType ,
1010 include_slider : bool ,
11- min : i32 ,
12- max : i32 ,
11+ min : i64 ,
12+ max : i64 ,
1313 target : StimulusTarget ,
1414 label : String ,
1515 name : String ,
16- initial_value : i32 ,
16+ initial_value : i64 ,
1717}
1818
1919impl RangeGroupPricingCalc {
@@ -40,12 +40,12 @@ impl RangeGroupPricingCalc {
4040 self
4141 }
4242
43- pub fn min ( mut self , min : i32 ) -> Self {
43+ pub fn min ( mut self , min : i64 ) -> Self {
4444 self . min = min;
4545 self
4646 }
4747
48- pub fn max ( mut self , max : i32 ) -> Self {
48+ pub fn max ( mut self , max : i64 ) -> Self {
4949 self . max = max;
5050 self
5151 }
@@ -65,7 +65,7 @@ impl RangeGroupPricingCalc {
6565 self
6666 }
6767
68- pub fn initial_value ( mut self , initial_value : i32 ) -> Self {
68+ pub fn initial_value ( mut self , initial_value : i64 ) -> Self {
6969 self . initial_value = initial_value;
7070 self
7171 }
You can’t perform that action at this time.
0 commit comments