biz9-logic 4.9.2 → 4.9.4

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.
Files changed (4) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +16 -15
  3. package/package.json +1 -1
  4. package/test.js +25 -12
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='8.7.2'
1
+ VERSION='8.7.4'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -55,7 +55,7 @@ class Item_Logic {
55
55
  static get_test_list = (data_type,option) =>{
56
56
  option = Field_Logic.get_option(data_type,option?option:{});
57
57
  let item_list = [];
58
- for(let a=0;a<option.item_count+1;a++){
58
+ for(let a=0;a<parseInt(option.item_count)+1;a++){
59
59
  item_list.push(Item_Logic.get_test("Item " +String(parseInt(a+1)),data_type,option));
60
60
  }
61
61
  return item_list;
@@ -131,7 +131,7 @@ class Demo_Logic {
131
131
  if(option.categorys){
132
132
  category_title_list = option.categorys.split(',');
133
133
  }else{
134
- for(let a = 1;a<option.category_count+1;a++){
134
+ for(let a = 1;a<parseInt(option.category_count)+1;a++){
135
135
  category_title_list.push(title + " Category " +a);
136
136
  }
137
137
  }
@@ -144,12 +144,14 @@ class Demo_Logic {
144
144
  if(option.items){
145
145
  item_title_list = option.items.split(',');
146
146
  }else{
147
- for(let b = 1;b<option.item_count+1;b++){
147
+ for(let b = 1;b<parseInt(option.item_count)+1;b++){
148
148
  item_title_list.push(title+" " +Type.get_title(item.categorys[Num.get_id(item.categorys.length)].category)+" "+ b);
149
149
  }
150
150
  }
151
- for(const cat_item of item.categorys){
151
+ const cat_item = item.categorys[Num.get_id(item.categorys.length)];
152
+ if(!cat_item.items){
152
153
  cat_item.items = [];
154
+ }
153
155
  for(const item of item_title_list){
154
156
  let child_item = Item_Logic.get_new(item,option.item_data_type);
155
157
  if(option.item_data_type == DataType.PRODUCT){
@@ -163,7 +165,6 @@ class Demo_Logic {
163
165
  child_item.note = Field_Logic.get_test_note(),
164
166
  cat_item.items.push(child_item);
165
167
  }
166
- }
167
168
  }
168
169
  return item;
169
170
  };
@@ -442,7 +443,7 @@ class Page_Logic {
442
443
  static get_test_list = (option) =>{
443
444
  option = Field_Logic.get_option(DataType.PAGE,option?option:{});
444
445
  let item_list = [];
445
- for(let a=0;a<option.page_count+1;a++){
446
+ for(let a=0;a<parseInt(option.page_count)+1;a++){
446
447
  item_list.push(Page_Logic.get_test( "Page " +parseInt(a+1)? !option.get_blank : "",option));
447
448
  }
448
449
  return item_list;
@@ -652,7 +653,7 @@ class Service_Logic {
652
653
  static get_test_list = (option) =>{
653
654
  option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
654
655
  let item_list = [];
655
- for(let a=0;a<option.service_count+1;a++){
656
+ for(let a=0;a<parseInt(option.service_count)+1;a++){
656
657
  item_list.push(Service_Logic.get_test("Service "+String(parseInt(a+1)),option));
657
658
  }
658
659
  return item_list;
@@ -663,7 +664,7 @@ class Service_Logic {
663
664
  let category_list = Category_Logic.get_type_category_list(DataType.SERVICE,option.category_count);
664
665
  let item_count = 0;
665
666
  for(let a=0;a<category_list.length;a++){
666
- for(let b=0;b<option.service_count;b++){
667
+ for(let b=0;b<parseInt(option.service_count);b++){
667
668
  item_count++;
668
669
  let service = Service_Logic.get_test("Service "+String(parseInt(b+1)),option);
669
670
  service.category = category_list[Num.get_id(category_list.length+1)].title;
@@ -689,7 +690,7 @@ class Content_Logic {
689
690
  static get_test_list = (option) =>{
690
691
  option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
691
692
  let item_list = [];
692
- for(let a=0;a<option.content_count+1;a++){
693
+ for(let a=0;a<parseInt(option.content_count)+1;a++){
693
694
  item_list.push(Content_Logic.get_test("Content " +String(parseInt(a+1)),option));
694
695
  }
695
696
  return item_list;
@@ -700,7 +701,7 @@ class Content_Logic {
700
701
  let category_list = Category_Logic.get_type_category_list(DataType.CONTENT,option.category_count);
701
702
  let item_count = 0;
702
703
  for(let a=0;a<category_list.length;a++){
703
- for(let b=0;b<option.content_count;b++){
704
+ for(let b=0;b<parseInt(option.content_count);b++){
704
705
  item_count++;
705
706
  let content = Content_Logic.get_test("Content "+String(parseInt(b+1)),option);
706
707
  content.category = category_list[Num.get_id(category_list.length+1)].title;
@@ -738,7 +739,7 @@ class Blog_Post_Logic {
738
739
  static get_test_list = (option) =>{
739
740
  option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
740
741
  let item_list = [];
741
- for(let a=0;a<option.blog_post_count+1;a++){
742
+ for(let a=0;a<parseInt(option.blog_post_count)+1;a++){
742
743
  item_list.push(Blog_Post_Logic.get_test("Blog Post " +String(parseInt(a+1)),option));
743
744
  }
744
745
  return item_list;
@@ -749,7 +750,7 @@ class Blog_Post_Logic {
749
750
  let category_list = Category_Logic.get_type_category_list(DataType.BLOG_POST,option.category_count);
750
751
  let item_count = 0;
751
752
  for(let a=0;a<category_list.length;a++){
752
- for(let b=0;b<option.blog_post_count;b++){
753
+ for(let b=0;b<parseInt(option.blog_post_count);b++){
753
754
  item_count++;
754
755
  let blog_post = Blog_Post_Logic.get_test("Blog Post "+String(parseInt(b+1)),option);
755
756
  blog_post.category = category_list[Num.get_id(category_list.length+1)].title;
@@ -840,7 +841,7 @@ class Event_Logic {
840
841
  static get_test_list = (option) =>{
841
842
  option = Field_Logic.get_option(DataType.EVENT,option?option:{});
842
843
  let item_list = [];
843
- for(let a=0;a<option.event_count+1;a++){
844
+ for(let a=0;a<parseInt(option.event_count)+1;a++){
844
845
  item_list.push(Event_Logic.get_test("Event "+String(parseInt(a+1)),option));
845
846
  }
846
847
  return item_list;
@@ -851,7 +852,7 @@ class Event_Logic {
851
852
  let category_list = Category_Logic.get_type_category_list(DataType.EVENT,option.category_count);
852
853
  let item_count = 0;
853
854
  for(let a=0;a<category_list.length;a++){
854
- for(let b=0;b<option.event_count;b++){
855
+ for(let b=0;b<parseInt(option.event_count);b++){
855
856
  item_count++;
856
857
  let event = Event_Logic.get_test("Event "+String(parseInt(b+1)),option);
857
858
  event.category = category_list[Num.get_id(category_list.length+1)].title;
@@ -967,7 +968,7 @@ class Field_Logic {
967
968
  return item;
968
969
  }
969
970
  static get_value_list(item,option){
970
- for(let b=0;b<option.value_count;b++){
971
+ for(let b=0;b<parseInt(option.value_count);b++){
971
972
  if(option.get_blank == false){
972
973
  item['value_'+String(b+1)] = 'value ' + String(b+1);
973
974
  item['field_'+String(b+1)] = Str.get_title_url(item['value_'+String(b+1)]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.9.2",
3
+ "version": "4.9.4",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -31,19 +31,32 @@ describe("connect", () => {
31
31
  series([
32
32
  function(call) {
33
33
  console.log('CONNECT-START');
34
- let demo_type_1 = Demo_Logic.get_new_type('Computer',{
35
- get_category:true,category_count:9,category_data_type:DataType.PRODUCT,categorys:'',
36
- get_item:true,item_count:9,item_data_type:DataType.PRODUCT,items:null});
37
- //Log.w('demo_type_1_categorys',demo_type_1.categorys);
38
- //Log.w('demo_type_1_categorys',demo_type_1.categorys[0]);
34
+ let post_type_list = [
35
+ Demo_Logic.get_new_type('Computer 1',{
36
+ get_category:true,category_count:12,category_data_type:DataType.PRODUCT,categorys:'',
37
+ get_item:true,item_count:50,item_data_type:DataType.PRODUCT,items:null}),
38
+ Demo_Logic.get_new_type('Computer 2',{
39
+ get_category:true,category_count:12,category_data_type:DataType.PRODUCT,categorys:'',
40
+ get_item:true,item_count:50,item_data_type:DataType.PRODUCT,items:null})
41
+ ];
39
42
 
40
- //Log.w('demo_type_1',demo_type_1);
41
- let total = 0;
42
- for(a=0;a<demo_type_1.categorys.length;a++){
43
- console.log(demo_type_1.categorys[a]);
44
- total = total+1;
45
- }
46
- Log.w('total',total);
43
+ Log.w('post_type_list',post_type_list);
44
+ let post_item_count = 0;
45
+ let post_category_count = 0;
46
+ for(const item_type of post_type_list){
47
+ for(const item_cat of item_type.categorys){
48
+ post_category_count = post_category_count+1;
49
+ if(!item_cat.items){
50
+ item_cat.items = []
51
+ }
52
+ for(const item_item of item_cat.items){
53
+ post_item_count = post_item_count+1;
54
+ }
55
+ }
56
+ };
57
+
58
+ Log.w('post_type_list',post_type_list);
59
+ Log.w('post_item_count',post_item_count);
47
60
 
48
61
  console.log('CONNECT-END');
49
62
  call();