mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Fixed issue with form field losing confidence value
This commit is contained in:
@@ -60,23 +60,31 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
|
||||
initValue$ = initEntry$.pipe(map((initEntry: VocabularyEntry) => {
|
||||
if (isNotEmpty(initEntry)) {
|
||||
// Integrate FormFieldMetadataValueObject with retrieved information
|
||||
return Object.assign(new FormFieldMetadataValueObject(), this.model.value, {
|
||||
value: initEntry.value,
|
||||
authority: initEntry.authority,
|
||||
display: initEntry.display,
|
||||
otherInformation: initEntry.otherInformation || null
|
||||
});
|
||||
return new FormFieldMetadataValueObject(
|
||||
initEntry.value,
|
||||
null,
|
||||
initEntry.authority,
|
||||
initEntry.display,
|
||||
null,
|
||||
null,
|
||||
initEntry.otherInformation || null
|
||||
);
|
||||
} else {
|
||||
return this.model.value as any;
|
||||
}
|
||||
}));
|
||||
} else if (isNotEmpty(this.model.value) && (this.model.value instanceof VocabularyEntry)) {
|
||||
initValue$ = observableOf(Object.assign(new FormFieldMetadataValueObject(), this.model.value, {
|
||||
value: this.model.value.value,
|
||||
authority: this.model.value.authority,
|
||||
display: this.model.value.display,
|
||||
otherInformation: this.model.value.otherInformation || null
|
||||
}));
|
||||
initValue$ = observableOf(
|
||||
new FormFieldMetadataValueObject(
|
||||
this.model.value.value,
|
||||
null,
|
||||
this.model.value.authority,
|
||||
this.model.value.display,
|
||||
null,
|
||||
null,
|
||||
this.model.value.otherInformation || null
|
||||
)
|
||||
);
|
||||
} else {
|
||||
initValue$ = observableOf(new FormFieldMetadataValueObject(this.model.value));
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ export class FormFieldMetadataValueObject implements MetadataValueInterface {
|
||||
this.display = display || value;
|
||||
|
||||
this.confidence = confidence;
|
||||
if (authority != null && isEmpty(confidence)) {
|
||||
if (authority != null && (isEmpty(confidence) || confidence === -1)) {
|
||||
this.confidence = ConfidenceType.CF_ACCEPTED;
|
||||
} else if (isNotEmpty(confidence)) {
|
||||
this.confidence = confidence;
|
||||
|
Reference in New Issue
Block a user