Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #61 from regulaforensics/develop
Browse files Browse the repository at this point in the history
Fix check results getAuthenticityCheckList
  • Loading branch information
aliaksandr-drozd authored Jun 6, 2024
2 parents 4f1a3a4 + f8ca76b commit 1276d67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.0.61",
"version": "0.0.62",
"author": "Regula Forensics, Inc.",
"name": "@regulaforensics/document-reader-recipes",
"description": "Document Reader Recipes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ export const getAuthenticityCheckList = (input: ProcessResponse): RAuthenticityC
})

list.forEach((item) => {
if (item.Result === eCheckResult.OK || item.Result === eCheckResult.WAS_NOT_DONE) {
current.checkResult = eCheckResult.OK
} else if (item.Result === eCheckResult.ERROR) {
current.checkResult = eCheckResult.ERROR
}

if (AuthenticityFibersTypeCheckResult.isBelongs(item)) {
item.List.forEach((subItem) => {
let groupIndex = current.groups.findIndex((group) => group.group === subItem.Type)
Expand Down Expand Up @@ -221,6 +215,15 @@ export const getAuthenticityCheckList = (input: ProcessResponse): RAuthenticityC
current.groups[index].checkResult = eCheckResult.ERROR
})

if (current.groups.every(({ checkResult }) => checkResult === eCheckResult.OK)) {
current.checkResult = eCheckResult.OK
} else if (current.groups.some(({ checkResult }) => checkResult === eCheckResult.WAS_NOT_DONE)) {
current.checkResult = eCheckResult.WAS_NOT_DONE
return
} else {
current.checkResult = eCheckResult.ERROR
}

current.groups.sort((a, b) => a.checkResult - b.checkResult)

result.push(current)
Expand Down

0 comments on commit 1276d67

Please sign in to comment.