@bento-core/paginated-table 1.0.1-ccdihub.52 → 1.0.1-ccdihub.54

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.
@@ -41,6 +41,15 @@ const ToolTipView = props => {
41
41
  }));
42
42
  };
43
43
  exports.ToolTipView = ToolTipView;
44
+ const checkDuplicate = (cartFiles, ids) => {
45
+ let duplicateCount = 0;
46
+ for (let i = 0; i < cartFiles.length; i += 1) {
47
+ if (ids.includes(cartFiles[i])) {
48
+ duplicateCount += 1;
49
+ }
50
+ }
51
+ return duplicateCount;
52
+ };
44
53
  const AddAllFilesComponent = props => {
45
54
  const {
46
55
  title,
@@ -74,8 +83,6 @@ const AddAllFilesComponent = props => {
74
83
  query: addFileQuery
75
84
  });
76
85
  const cartCount = cartFiles.length;
77
- console.log('!!!!!cartCount:', cartCount);
78
- console.log('!!!!!cartFiles:', cartFiles);
79
86
  if (fileCount <= 6000 && cartCount < 6000) {
80
87
  fileIds().then(response => {
81
88
  const data = response[responseKeys[0]];
@@ -89,11 +96,15 @@ const AddAllFilesComponent = props => {
89
96
  }
90
97
  return acc;
91
98
  }, []);
92
- console.log('!!!!!!ids:', ids);
93
99
  if (cartCount + fileCount <= 6000) {
94
100
  setAddFilesId(ids);
95
101
  } else {
96
- setAlterDisplay(true);
102
+ const duplicate = checkDuplicate(cartFiles, ids);
103
+ if (cartCount + fileCount - duplicate <= 6000) {
104
+ setAddFilesId(ids);
105
+ } else {
106
+ setAlterDisplay(true);
107
+ }
97
108
  }
98
109
  }
99
110
  setOpen(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "1.0.1-ccdihub.52",
3
+ "version": "1.0.1-ccdihub.54",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
@@ -34,6 +34,16 @@ export const ToolTipView = (props) => {
34
34
  );
35
35
  };
36
36
 
37
+ const checkDuplicate = (cartFiles, ids) => {
38
+ let duplicateCount = 0;
39
+ for (let i = 0; i < cartFiles.length; i += 1) {
40
+ if (ids.includes(cartFiles[i])) {
41
+ duplicateCount += 1;
42
+ }
43
+ }
44
+ return duplicateCount;
45
+ };
46
+
37
47
  const AddAllFilesComponent = (props) => {
38
48
  const {
39
49
  title,
@@ -67,8 +77,6 @@ const AddAllFilesComponent = (props) => {
67
77
  query: addFileQuery,
68
78
  });
69
79
  const cartCount = cartFiles.length;
70
- console.log('!!!!!cartCount:', cartCount);
71
- console.log('!!!!!cartFiles:', cartFiles);
72
80
  if (fileCount <= 6000 && cartCount < 6000) {
73
81
  fileIds().then((response) => {
74
82
  const data = response[responseKeys[0]];
@@ -82,11 +90,15 @@ const AddAllFilesComponent = (props) => {
82
90
  }
83
91
  return acc;
84
92
  }, []);
85
- console.log('!!!!!!ids:', ids);
86
93
  if (cartCount + fileCount <= 6000) {
87
94
  setAddFilesId(ids);
88
95
  } else {
89
- setAlterDisplay(true);
96
+ const duplicate = checkDuplicate(cartFiles, ids);
97
+ if (cartCount + fileCount - duplicate <= 6000) {
98
+ setAddFilesId(ids);
99
+ } else {
100
+ setAlterDisplay(true);
101
+ }
90
102
  }
91
103
  }
92
104
  setOpen(true);