DM-357: fix idRemoval mark as processed logic

This commit is contained in:
Kilian Schuettler 2023-08-18 11:06:01 +02:00
parent ccade4b5fd
commit ed90b6a9cc
2 changed files with 8 additions and 8 deletions

View File

@ -284,18 +284,16 @@ public class ManualRedactionService {
if (removeRedactionRequest.getComment() != null) {
commentId = addComment(fileId, removeRedactionRequest.getAnnotationId(), removeRedactionRequest.getComment(), removeRedactionRequest.getUser()).getId();
}
boolean matchingEntryFound = false;
if (!removeRedactionRequest.isRemoveFromDictionary() && AnnotationStatus.APPROVED.equals(removeRedactionRequest.getStatus())) {
boolean matchingEntryFound;
try {
getRedactionLogEntry(redactionLog, removeRedactionRequest.getAnnotationId());
matchingEntryFound = true;
} catch (NotFoundException e) {
matchingEntryFound = false;
log.warn("No matching entry found in redaction log for annotation id {}", removeRedactionRequest.getAnnotationId());
}
requiresReAnalysis = requiresReAnalysis || matchingEntryFound;
if (!matchingEntryFound && idRemoval.isApproved()) {
removeRedactionPersistenceService.markAsProcessed(idRemoval);
}
}
var removedFromDictionary = handleRemoveFromDictionary(redactionLog,
@ -307,7 +305,7 @@ public class ManualRedactionService {
removeRedactionRequest.isRemoveFromAllDossiers(),
false);
if (!removedFromDictionary && idRemoval.isApproved()) {
if (!matchingEntryFound && !removedFromDictionary && idRemoval.isApproved()) {
removeRedactionPersistenceService.markAsProcessed(idRemoval);
}

View File

@ -87,8 +87,10 @@ public class RedactionLogMergeService {
var manualRedactionWrappers = createManualRedactionWrappers(manualRedactions);
for (RedactionLogEntry entry : redactionLog.getRedactionLogEntry()) {
processRedactionLogEntry(manualRedactionWrappers.stream().filter(mr -> entry.getId().equals(mr.getId())).collect(Collectors.toList()), entry, types, colors);
var applicableManualRedactions = manualRedactionWrappers.stream().filter(mr -> entry.getId().equals(mr.getId())).collect(Collectors.toList());
if (!applicableManualRedactions.isEmpty()) {
processRedactionLogEntry(applicableManualRedactions, entry, types, colors);
}
if (entry.isImported() && !entry.isRedacted()) {
skippedImportedRedactions.add(entry.getId());