hide declined suggestions, fix false positive

This commit is contained in:
Timo 2021-01-09 14:34:45 +02:00
parent 5c75ec2e04
commit d5485882e4
3 changed files with 21 additions and 12 deletions

View File

@ -186,10 +186,10 @@ export class AnnotationActionsService {
let text;
if (annotation.hasTextAfter) {
text = getFirstRelevantTextPart(annotation.textAfter, 'FORWARD');
return annotation.value + text;
return (annotation.value + text).trim();
} else {
text = getFirstRelevantTextPart(annotation.textBefore, 'BACKWARD');
return text + annotation.value;
return (text + annotation.value).trim();
}
}
}

View File

@ -41,13 +41,15 @@ export class FileDataModel {
this.redactionLog.redactionLogEntry.forEach((redactionLogEntry) => {
// false positive entries from the redaction-log need to be skipped
if (redactionLogEntry.type !== 'false_positive') {
// copy the redactionLog Entry
const redactionLogEntryWrapper: RedactionLogEntryWrapper = { actionPendingReanalysis: false };
Object.assign(redactionLogEntryWrapper, redactionLogEntry);
redactionLogEntryWrapper.comments = this.manualRedactions.comments[redactionLogEntryWrapper.id];
result.push(redactionLogEntryWrapper);
if (redactionLogEntry.type === 'false_positive') {
return;
}
// copy the redactionLog Entry
const redactionLogEntryWrapper: RedactionLogEntryWrapper = { actionPendingReanalysis: false };
Object.assign(redactionLogEntryWrapper, redactionLogEntry);
redactionLogEntryWrapper.comments = this.manualRedactions.comments[redactionLogEntryWrapper.id];
result.push(redactionLogEntryWrapper);
});
this.manualRedactions.entriesToAdd.forEach((manual) => {
@ -62,6 +64,11 @@ export class FileDataModel {
// an entry for this request already exists in the redactionLog
if (!!relevantRedactionLogEntry) {
if (relevantRedactionLogEntry.status === 'DECLINED') {
relevantRedactionLogEntry.hidden = true;
return;
}
relevantRedactionLogEntry.userId = manual.user;
relevantRedactionLogEntry.dictionaryEntry = manual.addToDictionary;

View File

@ -53,12 +53,14 @@ export function getFirstRelevantTextPart(text, direction: 'FORWARD' | 'BACKWARD'
if (breakChars.indexOf(char) >= 0) {
spaceCount += 1;
}
if (spaceCount >= 2) {
return true;
}
accumulator += char;
return false;
if (spaceCount >= 2) {
return true;
} else {
return false;
}
};
if (direction === 'FORWARD') {