From adeb4885ff6ade352628dc5868459ec8f22583aa Mon Sep 17 00:00:00 2001 From: Timo Date: Fri, 8 Jan 2021 18:21:15 +0200 Subject: [PATCH] corner case handling for recommendations --- .../src/app/screens/file/model/annotation.wrapper.ts | 7 ++++--- apps/red-ui/src/app/screens/file/model/file-data.model.ts | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts b/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts index e04eb00ea..41da3cb8f 100644 --- a/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts +++ b/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts @@ -164,9 +164,10 @@ export class AnnotationWrapper { annotationWrapper.textAfter = redactionLogEntry.textAfter; annotationWrapper.dictionaryOperation = redactionLogEntry.dictionaryEntry; annotationWrapper.userId = redactionLogEntry.userId; - annotationWrapper.content = AnnotationWrapper._createContent(redactionLogEntry); AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry); AnnotationWrapper._handleRecommendations(annotationWrapper, redactionLogEntry); + + AnnotationWrapper._createContent(annotationWrapper, redactionLogEntry); annotationWrapper.typeLabel = 'annotation-type.' + annotationWrapper.superType; return annotationWrapper; @@ -225,7 +226,7 @@ export class AnnotationWrapper { } } - private static _createContent(entry: any) { + private static _createContent(annotationWrapper: AnnotationWrapper, entry: RedactionLogEntryWrapper) { let content = ''; if (entry.matchedRule) { content += 'Rule ' + entry.matchedRule + ' matched \n\n'; @@ -239,6 +240,6 @@ export class AnnotationWrapper { if (entry.section) { content += 'In section: "' + entry.section + '"'; } - return content; + annotationWrapper.content = content; } } diff --git a/apps/red-ui/src/app/screens/file/model/file-data.model.ts b/apps/red-ui/src/app/screens/file/model/file-data.model.ts index 0065cff8c..6e547b6af 100644 --- a/apps/red-ui/src/app/screens/file/model/file-data.model.ts +++ b/apps/red-ui/src/app/screens/file/model/file-data.model.ts @@ -95,6 +95,10 @@ export class FileDataModel { redactionLogEntryWrapper.manualRedactionType = 'ADD'; redactionLogEntryWrapper.manual = true; redactionLogEntryWrapper.comments = this.manualRedactions.comments[redactionLogEntryWrapper.id]; + if (!!markedAsReasonRedactionLogEntry) { + // cleanup reason if the reason is another annotationId - it is not needed for drawing + redactionLogEntryWrapper.reason = null; + } result.push(redactionLogEntryWrapper); }