Fixed some issues with declined suggestions

This commit is contained in:
Timo Bejan 2022-02-09 12:01:46 +02:00
parent 4629be6703
commit ce0178d926
3 changed files with 22 additions and 33 deletions

View File

@ -258,6 +258,7 @@ export class AnnotationWrapper {
annotationWrapper.section = redactionLogEntry.section;
annotationWrapper.reference = redactionLogEntry.reference || [];
annotationWrapper.rectangle = redactionLogEntry.rectangle;
annotationWrapper.hintDictionary = redactionLogEntry.hintDictionary;
annotationWrapper.hasBeenResized = !!redactionLogEntry.manualChanges?.find(
c => c.manualRedactionType === ManualRedactionType.RESIZE && c.annotationStatus === LogEntryStatus.APPROVED,
);
@ -303,7 +304,11 @@ export class AnnotationWrapper {
annotationWrapper.pending = !lastManualChange.processed;
annotationWrapper.superType = AnnotationWrapper._selectSuperType(redactionLogEntryWrapper, lastManualChange);
annotationWrapper.superType = AnnotationWrapper._selectSuperType(
redactionLogEntryWrapper,
lastManualChange,
annotationWrapper.hintDictionary,
);
} else {
if (redactionLogEntryWrapper.recommendation) {
annotationWrapper.superType = 'recommendation';
@ -350,22 +355,11 @@ export class AnnotationWrapper {
return annotationWrapper.legalBasis;
}
// | 'suggestion-change-legal-basis'
// | 'suggestion-recategorize-image'
// | 'suggestion-add-dictionary'
// | 'suggestion-force-redaction'
// | 'suggestion-resize'
// | 'suggestion-remove-dictionary'
// | 'suggestion-add'
// | 'suggestion-remove'
// | 'ignored-hint'
// | 'skipped'
// | 'redaction'
// | 'manual-redaction'
// | 'recommendation'
// | 'hint'
// | 'declined-suggestion';
private static _selectSuperType(redactionLogEntry: RedactionLogEntry, lastManualChange: IManualChange): AnnotationSuperType {
private static _selectSuperType(
redactionLogEntry: RedactionLogEntry,
lastManualChange: IManualChange,
isHintDictionary: boolean,
): AnnotationSuperType {
switch (lastManualChange.manualRedactionType) {
case ManualRedactionType.ADD_LOCALLY:
switch (lastManualChange.annotationStatus) {
@ -380,8 +374,7 @@ export class AnnotationWrapper {
case ManualRedactionType.ADD_TO_DICTIONARY:
switch (lastManualChange.annotationStatus) {
case LogEntryStatus.APPROVED:
// TODO
return 'redaction';
return isHintDictionary ? 'hint' : 'redaction';
case LogEntryStatus.DECLINED:
return 'declined-suggestion';
case LogEntryStatus.REQUESTED:
@ -391,9 +384,9 @@ export class AnnotationWrapper {
case ManualRedactionType.REMOVE_LOCALLY:
switch (lastManualChange.annotationStatus) {
case LogEntryStatus.APPROVED:
return 'skipped';
return isHintDictionary ? 'ignored-hint' : 'skipped';
case LogEntryStatus.DECLINED:
return 'declined-suggestion';
return isHintDictionary ? 'hint' : redactionLogEntry.redacted ? 'redaction' : 'skipped';
case LogEntryStatus.REQUESTED:
return 'suggestion-remove';
}
@ -401,10 +394,9 @@ export class AnnotationWrapper {
case ManualRedactionType.REMOVE_FROM_DICTIONARY:
switch (lastManualChange.annotationStatus) {
case LogEntryStatus.APPROVED:
// TODO
return 'skipped';
case LogEntryStatus.DECLINED:
return 'declined-suggestion';
return 'redaction';
case LogEntryStatus.REQUESTED:
return 'suggestion-remove-dictionary';
}
@ -412,10 +404,9 @@ export class AnnotationWrapper {
case ManualRedactionType.FORCE_REDACT:
switch (lastManualChange.annotationStatus) {
case LogEntryStatus.APPROVED:
// TODO
return 'redaction';
case LogEntryStatus.DECLINED:
return 'declined-suggestion';
return 'skipped';
case LogEntryStatus.REQUESTED:
return 'suggestion-force-redaction';
}
@ -423,10 +414,9 @@ export class AnnotationWrapper {
case ManualRedactionType.FORCE_HINT:
switch (lastManualChange.annotationStatus) {
case LogEntryStatus.APPROVED:
// TODO
return 'redaction';
case LogEntryStatus.DECLINED:
return 'declined-suggestion';
return 'ignored-hint';
case LogEntryStatus.REQUESTED:
return 'suggestion-force-hint';
}
@ -434,9 +424,8 @@ export class AnnotationWrapper {
case ManualRedactionType.RECATEGORIZE:
switch (lastManualChange.annotationStatus) {
case LogEntryStatus.APPROVED:
return redactionLogEntry.redacted ? 'redaction' : 'hint';
case LogEntryStatus.DECLINED:
return 'declined-suggestion';
return redactionLogEntry.redacted ? 'redaction' : 'hint';
case LogEntryStatus.REQUESTED:
return 'suggestion-recategorize-image';
}
@ -444,9 +433,8 @@ export class AnnotationWrapper {
case ManualRedactionType.LEGAL_BASIS_CHANGE:
switch (lastManualChange.annotationStatus) {
case LogEntryStatus.APPROVED:
return 'redaction';
case LogEntryStatus.DECLINED:
return 'declined-suggestion';
return 'redaction';
case LogEntryStatus.REQUESTED:
return 'suggestion-change-legal-basis';
}
@ -454,13 +442,12 @@ export class AnnotationWrapper {
case ManualRedactionType.RESIZE:
switch (lastManualChange.annotationStatus) {
case LogEntryStatus.APPROVED:
case LogEntryStatus.DECLINED:
if (redactionLogEntry.recommendation) {
return 'recommendation';
} else {
return redactionLogEntry.redacted ? 'redaction' : 'hint';
}
case LogEntryStatus.DECLINED:
return 'declined-suggestion';
case LogEntryStatus.REQUESTED:
return 'suggestion-resize';
}

View File

@ -95,6 +95,7 @@ export class FileDataModel {
changeLogValues.isChangeLogEntry,
changeLogValues.hidden,
this.redactionLog.legalBasis,
this._dictionaryData[redactionLogEntry.type].hint,
);
if (

View File

@ -37,6 +37,7 @@ export class RedactionLogEntry implements IRedactionLogEntry {
readonly isChangeLogEntry: boolean,
readonly hidden: boolean,
readonly legalBasisList: ILegalBasis[],
readonly hintDictionary: boolean,
) {
this.changes = redactionLogEntry.changes;
this.manualChanges = redactionLogEntry.manualChanges;