removed cleanup of viewed pages
This commit is contained in:
parent
6122080fc9
commit
cee9ef35ca
@ -1,6 +1,5 @@
|
||||
package com.iqser.red.service.peristence.v1.server.service;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ViewedPageEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.ViewedPagesPersistenceService;
|
||||
@ -12,9 +11,7 @@ import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@ -30,11 +27,6 @@ public class AnalysisFlagsCalculationService {
|
||||
|
||||
@Async
|
||||
public void calculateFlags(String dossierId, String fileId) {
|
||||
this.calculateFlags(dossierId,fileId, Sets.newHashSet());
|
||||
}
|
||||
|
||||
@Async
|
||||
public void calculateFlags(String dossierId, String fileId, Set<Integer> pagesToSkip) {
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
@ -53,9 +45,6 @@ public class AnalysisFlagsCalculationService {
|
||||
boolean hasComments = false;
|
||||
|
||||
|
||||
var viewedPagesToReset = new ArrayList<Integer>();
|
||||
|
||||
|
||||
for (RedactionLogEntry entry : redactionLog.getRedactionLogEntry()) {
|
||||
if (entry.isExcluded()) {
|
||||
continue;
|
||||
@ -89,16 +78,12 @@ public class AnalysisFlagsCalculationService {
|
||||
var viewedPage = entry.getPositions().isEmpty() ? null : viewedPages.get(entry.getPositions().get(0).getPage());
|
||||
|
||||
if (lastChange != null && lastChange.getDateTime() != null && viewedPage != null && viewedPage.isBefore(lastChange.getDateTime())) {
|
||||
viewedPagesToReset.add(entry.getPositions().get(0).getPage());
|
||||
hasUpdates = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
viewedPagesToReset.removeAll(pagesToSkip);
|
||||
|
||||
viewedPagesPersistenceService.resetViewedPages(fileId, file.getCurrentReviewer(), viewedPagesToReset);
|
||||
fileStatusPersistenceService.updateFlags(fileId, hasRedactions, hasHints, hasImages, hasSuggestions, hasComments, hasUpdates);
|
||||
|
||||
log.info("Flag Calculations for file: {} took: {}ms", fileId, System.currentTimeMillis() - startTime);
|
||||
|
||||
@ -88,7 +88,7 @@ public class ManualRedactionService {
|
||||
}
|
||||
|
||||
if (!addRedactionRequest.getPositions().isEmpty()) {
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(addRedactionRequest.getPositions().get(0).getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
}
|
||||
|
||||
return ManualAddResponse.builder().annotationId(annotationId).commentId(commentId).build();
|
||||
@ -120,7 +120,7 @@ public class ManualRedactionService {
|
||||
}
|
||||
|
||||
if (!removeRedactionRequest.isRemoveFromDictionary()) {
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(removeRedactionRequest.getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
}
|
||||
|
||||
return ManualAddResponse.builder()
|
||||
@ -151,7 +151,7 @@ public class ManualRedactionService {
|
||||
fileStatusPersistenceService.updateLastManualRedaction(fileId, now);
|
||||
}
|
||||
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(forceRedactionRequest.getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
|
||||
return ManualAddResponse.builder()
|
||||
.annotationId(forceRedactionRequest.getAnnotationId())
|
||||
@ -181,7 +181,7 @@ public class ManualRedactionService {
|
||||
fileStatusPersistenceService.updateLastManualRedaction(fileId, now);
|
||||
}
|
||||
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(legalBasisChangeRequest.getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
|
||||
return ManualAddResponse.builder()
|
||||
.annotationId(legalBasisChangeRequest.getAnnotationId())
|
||||
@ -286,7 +286,7 @@ public class ManualRedactionService {
|
||||
}
|
||||
|
||||
if (!addRedaction.getPositions().isEmpty()) {
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(addRedaction.getPositions().get(0).getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,7 +307,7 @@ public class ManualRedactionService {
|
||||
} else {
|
||||
fileStatusPersistenceService.updateLastManualRedaction(fileId, OffsetDateTime.now());
|
||||
}
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(removeRedaction.getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
}
|
||||
|
||||
|
||||
@ -323,7 +323,7 @@ public class ManualRedactionService {
|
||||
} else {
|
||||
fileStatusPersistenceService.updateLastManualRedaction(fileId, OffsetDateTime.now());
|
||||
}
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(forceRedaction.getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
}
|
||||
|
||||
|
||||
@ -338,7 +338,7 @@ public class ManualRedactionService {
|
||||
} else {
|
||||
fileStatusPersistenceService.updateLastManualRedaction(fileId, OffsetDateTime.now());
|
||||
}
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(legalBasisChange.getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
}
|
||||
|
||||
|
||||
@ -407,7 +407,7 @@ public class ManualRedactionService {
|
||||
boolean hasSuggestions = calculateHasSuggestions(fileId);
|
||||
fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions);
|
||||
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(idRemoval.getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
}
|
||||
|
||||
private String buildTypeId(RedactionLogEntry redactionLogEntry, DossierEntity dossier) {
|
||||
@ -458,7 +458,7 @@ public class ManualRedactionService {
|
||||
recategorizationPersistenceService.updateStatus(fileId, annotationId, annotationStatus);
|
||||
boolean hasSuggestions = calculateHasSuggestions(fileId);
|
||||
fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions);
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(imageRecategorization.getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
}
|
||||
|
||||
|
||||
@ -484,7 +484,7 @@ public class ManualRedactionService {
|
||||
boolean hasSuggestions = calculateHasSuggestions(fileId);
|
||||
fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions);
|
||||
if (!manualRedactionEntry.getPositions().isEmpty()) {
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId, Sets.newHashSet(manualRedactionEntry.getPositions().get(0).getPage()));
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user