biz9-logic 4.0.21 → 4.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='4.2.1'
1
+ VERSION='4.2.2'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -65,7 +65,8 @@ class Product{
65
65
  product.type = "Type "+String(Number.get_id());
66
66
  product.sub_type = "Sub Type "+String(Number.get_id());
67
67
  product.stock = String(Number.get_id(3-1));
68
- product.category = Category.get_type_category_list(DataType.PRODUCT)[Number.get_id(Category.get_type_category_list(DataType.PRODUCT).length-1)].title;
68
+ //product.category = Category.get_type_category_list(DataType.PRODUCT)[Number.get_id(Category.get_type_category_list(DataType.PRODUCT).length-1)].title;
69
+ product.category ="Category " + String(Number.get_id());
69
70
  if(option.get_items){
70
71
  product = Sub_Item.get_test_bind_new_child(Number.get_id(),title,product,product,product);
71
72
  for(let a=0;a<10;a++){
@@ -77,20 +78,30 @@ class Product{
77
78
  };
78
79
  static get_test_list_by_category = (option) =>{
79
80
  let product_list = [];
80
- let category_list = Category.get_type_category_list(DataType.PRODUCT);
81
+ let category_count = 9;
82
+ let product_count = 19;
83
+ if(!option){
84
+ option={};
85
+ }
86
+ else{
87
+ if(option.category_count){
88
+ category_count = parseInt(option.category_count);
89
+ }
90
+ if(option.category_count){
91
+ product_count = parseInt(option.product_count);
92
+ }
93
+ }
94
+ let category_list = Category.get_type_category_list(DataType.PRODUCT,category_count);
81
95
  for(let a=0;a<category_list.length;a++){
82
- for(let b=0;b<19;b++){
96
+ for(let b=0;b<product_count;b++){
83
97
  let product = Product.get_test("Product " + b);
84
98
  product.category = category_list[Number.get_id(category_list.length-1)].title;
85
99
  product_list.push(product);
86
100
  }
87
101
  }
88
- //Log.w('category_list',category_list.length);
89
- //Log.w('product_list',product_list.length);
90
102
  return [category_list,product_list]
91
103
  };
92
104
  }
93
-
94
105
  class Service{
95
106
  static get_test = (title) =>{
96
107
  let service = DataItem.get_new_full_item(
@@ -422,9 +433,9 @@ class Category {
422
433
  category.type = Category.get_category_list()[Number.get_id(category_list.length-1)].data_type;
423
434
  return category;
424
435
  }
425
- static get_type_category_list(type){
436
+ static get_type_category_list(type,count){
426
437
  let category_list = [];
427
- for(let a=0;a<20;a++){
438
+ for(let a=0;a<count;a++){
428
439
  let category = DataItem.get_new_full_item(
429
440
  DataItem.get_new(DataType.CATEGORY,"Category "+Number.get_id()),
430
441
  DataItem.get_new(DataType.CATEGORY,0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.0.21",
3
+ "version": "4.0.22",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -52,7 +52,7 @@ describe("connect", () => {
52
52
  /* --PRODUCT--START */
53
53
  //let product = Product.get_test_list_by_category();
54
54
  //Log.w('product_test',Product.get_test("Product " + Number.get_id(),{get_items:false}));
55
- Log.w('product_list_test',Product.get_test_list_by_category("Product " + Number.get_id(),{get_items:false}));
55
+ Log.w('product_list_test',Product.get_test_list_by_category({get_items:false,product_count:2,category_count:3}));
56
56
  //console.log(Product.get_test("Product " + Number.get_id(),{get_items:false}));
57
57
  /* --PRODUCT--END */
58
58