biz9-logic 4.0.21 → 4.0.23

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.3'
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,32 @@ 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);
95
+ let item_count = 0;
81
96
  for(let a=0;a<category_list.length;a++){
82
- for(let b=0;b<19;b++){
83
- let product = Product.get_test("Product " + b);
97
+ for(let b=0;b<product_count;b++){
98
+ item_count++;
99
+ let product = Product.get_test("Product " + String(item_count));
84
100
  product.category = category_list[Number.get_id(category_list.length-1)].title;
85
101
  product_list.push(product);
86
102
  }
87
103
  }
88
- //Log.w('category_list',category_list.length);
89
- //Log.w('product_list',product_list.length);
90
104
  return [category_list,product_list]
91
105
  };
92
106
  }
93
-
94
107
  class Service{
95
108
  static get_test = (title) =>{
96
109
  let service = DataItem.get_new_full_item(
@@ -422,9 +435,9 @@ class Category {
422
435
  category.type = Category.get_category_list()[Number.get_id(category_list.length-1)].data_type;
423
436
  return category;
424
437
  }
425
- static get_type_category_list(type){
438
+ static get_type_category_list(type,count){
426
439
  let category_list = [];
427
- for(let a=0;a<20;a++){
440
+ for(let a=0;a<count;a++){
428
441
  let category = DataItem.get_new_full_item(
429
442
  DataItem.get_new(DataType.CATEGORY,"Category "+Number.get_id()),
430
443
  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.23",
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:9,category_count:3}));
56
56
  //console.log(Product.get_test("Product " + Number.get_id(),{get_items:false}));
57
57
  /* --PRODUCT--END */
58
58