]> hackdaworld.org Git - outofuni/tavern2.git/commitdiff
string double issue fixed master
authorhackbard <hackbard@hackdaworld.org>
Wed, 26 Oct 2016 19:29:08 +0000 (21:29 +0200)
committerhackbard <hackbard@hackdaworld.org>
Wed, 26 Oct 2016 19:29:08 +0000 (21:29 +0200)
lib/product_component.dart
lib/product_detail_component.dart

index 6fb5461cb7095d3191aa8166e03392b4cc79e93a..7e429f8b712b29322cb75d5a1f272527643b9e0e 100644 (file)
@@ -31,7 +31,7 @@ class ProductComponent implements OnInit {
        String prod_category_name;
 
        String prod_name;
-       double prod_price;
+       String prod_price;
        int prodcnt;
 
        List<Product> 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);
index 59f9fab6bc73a747d4662aa6f9337abe41e2243f..4a816add6fda2f448e5cc1ee8b23058a81ebdbbe 100644 (file)
@@ -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<Null> 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;
                }