From: hackbard Date: Wed, 26 Oct 2016 19:29:08 +0000 (+0200) Subject: string double issue fixed X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;ds=inline;p=outofuni%2Ftavern2.git string double issue fixed --- diff --git a/lib/product_component.dart b/lib/product_component.dart index 6fb5461..7e429f8 100644 --- a/lib/product_component.dart +++ b/lib/product_component.dart @@ -31,7 +31,7 @@ class ProductComponent implements OnInit { String prod_category_name; String prod_name; - double prod_price; + String prod_price; int prodcnt; List products; @@ -73,7 +73,7 @@ class ProductComponent implements OnInit { if(prod_name==null || prod_price==null) return; print('Debug: Creating product '+prod_name+'/'+ - prod_price.toString()); + prod_price); String id = await _prodSrv.createProduct(prod_name, double.parse(prod_price), catid); diff --git a/lib/product_detail_component.dart b/lib/product_detail_component.dart index 59f9fab..4a816ad 100644 --- a/lib/product_detail_component.dart +++ b/lib/product_detail_component.dart @@ -31,12 +31,12 @@ class ProductDetailComponent implements OnInit { String prod_name; String prod_category; - double prod_price; + String prod_price; ProductDetailComponent(this._prodSrv,this._prodcatSrv, this._routeParams) { prod_name='Product'; - prod_price=0; + prod_price='0'; } Future ngOnInit() async { @@ -46,7 +46,7 @@ class ProductDetailComponent implements OnInit { prodcats = await (_prodcatSrv.getAll()); } prod_name=prod.name; - prod_price=prod.price; + prod_price=prod.price.toString(); prod_category=prod.category; } @@ -55,7 +55,7 @@ class ProductDetailComponent implements OnInit { if(prod.name!=prod_name) { doupdate=true; } - if(prod.price!=prod_price) { + if(prod.price.toString()!=prod_price) { doupdate=true; } if(prod.category!=prod_category) { @@ -65,15 +65,15 @@ class ProductDetailComponent implements OnInit { print('Debug: Updating product '+ prod.name+'/'+prod.price.toString()+'/'+ prod.category+' -> '+ - prod_name+'/'+prod_price.toString()+'/'+ + prod_name+'/'+prod_price+'/'+ prod_category); await _prodSrv.updateProd( prod.id, prod_name, - prod_price, + double.parse(prod_price), prod_category ); - prod.price=prod_price; + prod.price=double.parse(prod_price); prod.name=prod_name; prod.category=prod_category; }