Manage different level of confidence in the submission

This commit is contained in:
Giuseppe Digilio
2018-12-06 22:39:18 +01:00
parent fcd997dba3
commit 2d20d524de
20 changed files with 475 additions and 190 deletions

View File

@@ -1,4 +1,5 @@
import { isNotEmpty, isNotNull } from '../../../empty.util';
import { isEmpty, isNotEmpty, isNotNull } from '../../../empty.util';
import { ConfidenceType } from '../../../../core/integration/models/confidence-type';
export class FormFieldMetadataValueObject {
metadata?: string;
@@ -6,7 +7,7 @@ export class FormFieldMetadataValueObject {
display: string;
language: any;
authority: string;
confidence: number;
confidence: ConfidenceType;
place: number;
closed: boolean;
label: string;
@@ -17,7 +18,7 @@ export class FormFieldMetadataValueObject {
authority: string = null,
display: string = null,
place: number = 0,
confidence: number = -1,
confidence: number = null,
otherInformation: any = null,
metadata: string = null) {
this.value = isNotNull(value) ? ((typeof value === 'string') ? value.trim() : value) : null;
@@ -26,10 +27,12 @@ export class FormFieldMetadataValueObject {
this.display = display || value;
this.confidence = confidence;
if (authority != null) {
this.confidence = 600;
if (authority != null && isEmpty(confidence)) {
this.confidence = ConfidenceType.CF_ACCEPTED;
} else if (isNotEmpty(confidence)) {
this.confidence = confidence;
} else {
this.confidence = ConfidenceType.CF_UNSET;
}
this.place = place;