@konfuzio/document-validation-ui 0.1.50-dev.0 → 0.1.50-dev.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.50-dev.0",
3
+ "version": "0.1.50-dev.1",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -19,9 +19,9 @@
19
19
  </div>
20
20
  <div class="bottom-part">
21
21
  {{
22
- `${numberOfDocumentInSet(selectedDocument.id)} ${categoryName(
22
+ `${categoryName(
23
23
  selectedDocument.category
24
- )}`
24
+ )} ${numberOfDocumentInSet(selectedDocument)}`
25
25
  }}
26
26
  </div>
27
27
  </div>
@@ -41,7 +41,7 @@
41
41
  >
42
42
  <span>
43
43
  {{
44
- `${numberOfDocumentInSet(doc.id)} ${categoryName(doc.category)}`
44
+ `${categoryName(doc.category)} ${numberOfDocumentInSet(doc)}`
45
45
  }}</span
46
46
  >
47
47
  </b-dropdown-item>
@@ -523,18 +523,35 @@ const getters = {
523
523
  /**
524
524
  * Checks the number of current document in the document set
525
525
  */
526
- numberOfDocumentInSet: (state) => (documentId) => {
527
- return "";
528
- let index = -1;
526
+ numberOfDocumentInSet: (state) => (document) => {
527
+ let found = false;
528
+ let value = 0;
529
+ let index = 0;
529
530
  if (state.documentSet && state.documentSet.documents) {
530
- state.documentSet.documents.forEach((docTemp, indexTemp) => {
531
- if (docTemp.id == documentId) {
532
- index = indexTemp;
533
- return;
531
+ state.documentSet.documents.map((documentSetTemp) => {
532
+ if (
533
+ documentSetTemp.id !== document.id &&
534
+ documentSetTemp.category === document.category
535
+ ) {
536
+ found = true;
537
+ index++;
538
+ } else if (documentSetTemp.id === document.id) {
539
+ value = index;
534
540
  }
535
541
  });
542
+ return found ? `${value + 1}` : "";
536
543
  }
537
- return index === -1 ? "" : `${index + 1}`;
544
+ return "";
545
+ // let index = -1;
546
+ // if (state.documentSet && state.documentSet.documents) {
547
+ // state.documentSet.documents.forEach((docTemp, indexTemp) => {
548
+ // if (docTemp.id == documentId) {
549
+ // index = indexTemp;
550
+ // return;
551
+ // }
552
+ // });
553
+ // }
554
+ // return index === -1 ? "" : `${index + 1}`;
538
555
  },
539
556
 
540
557
  /**