RED-4424-"lastReviewer" is always equal to "assignee" in the file status
- setStatus before setAssignee. Set lastReviewer, lastApprover with the last assignee and not the current assignee - update tests
This commit is contained in:
parent
fa077dfaab
commit
5c1b732b7d
@ -91,9 +91,9 @@ public class FileStatusController implements StatusResource {
|
||||
String assignee = fileStatus.getAssignee();
|
||||
if (userId != null) {
|
||||
assignee = userId;
|
||||
fileStatusService.setAssignee(fileId, assignee);
|
||||
}
|
||||
fileStatusService.setStatusSuccessful(fileId, assignee != null ? WorkflowStatus.UNDER_REVIEW : WorkflowStatus.NEW);
|
||||
fileStatusService.setAssignee(fileId, assignee);
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
indexingService.addToIndexingQueue(IndexMessageType.UPDATE, null, dossierId, fileId, 2);
|
||||
}
|
||||
@ -108,8 +108,8 @@ public class FileStatusController implements StatusResource {
|
||||
assignee = approverId;
|
||||
|
||||
}
|
||||
fileStatusService.setStatusSuccessful(fileId, assignee != null ? WorkflowStatus.UNDER_APPROVAL : WorkflowStatus.NEW);
|
||||
fileStatusService.setAssignee(fileId, approverId);
|
||||
fileStatusService.setStatusSuccessful(fileId, assignee != null ? WorkflowStatus.UNDER_APPROVAL : WorkflowStatus.NEW);
|
||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
||||
indexingService.addToIndexingQueue(IndexMessageType.UPDATE, null, dossierId, fileId, 2);
|
||||
}
|
||||
|
||||
@ -384,10 +384,10 @@ public class FileStatusService {
|
||||
String lastReviewer = fileStatus.getLastReviewer();
|
||||
String lastApprover = fileStatus.getLastApprover();
|
||||
if (WorkflowStatus.UNDER_REVIEW.equals(fileStatus.getWorkflowStatus())) {
|
||||
lastReviewer = StringUtils.isNotEmpty(assignee) ? assignee : fileStatus.getAssignee();
|
||||
lastReviewer = StringUtils.isNotEmpty(assignee) ? fileStatus.getAssignee() : lastReviewer;
|
||||
}
|
||||
if (WorkflowStatus.UNDER_APPROVAL.equals(fileStatus.getWorkflowStatus())) {
|
||||
lastApprover = StringUtils.isNotEmpty(assignee) ? assignee : fileStatus.getAssignee();
|
||||
lastApprover = StringUtils.isNotEmpty(assignee) ? fileStatus.getAssignee() : lastApprover;
|
||||
}
|
||||
|
||||
fileStatusPersistenceService.setAssignee(fileId, assignee, lastReviewer, lastApprover);
|
||||
|
||||
@ -491,4 +491,51 @@ public class FileTest extends AbstractPersistenceServerServiceTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFile4424() {
|
||||
|
||||
var start = OffsetDateTime.now();
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier();
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
// update dossier - add new member
|
||||
CreateOrUpdateDossierRequest cru = new CreateOrUpdateDossierRequest();
|
||||
BeanUtils.copyProperties(dossier, cru);
|
||||
cru.getMemberIds().add("2");
|
||||
|
||||
var loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getAssignee()).isNull();
|
||||
assertThat(loadedFile.getWorkflowStatus()).isEqualTo(WorkflowStatus.NEW);
|
||||
assertThat(loadedFile.getLastReviewer()).isNull();
|
||||
assertThat(loadedFile.getLastApprover()).isNull();
|
||||
|
||||
fileClient.setStatusUnderReview(dossier.getId(), file.getId(), "1");
|
||||
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getWorkflowStatus()).isEqualTo(WorkflowStatus.UNDER_REVIEW);
|
||||
assertThat(loadedFile.getAssignee()).isEqualTo("1");
|
||||
assertThat(loadedFile.getLastReviewer()).isNull();
|
||||
assertThat(loadedFile.getLastApprover()).isNull();
|
||||
|
||||
fileClient.setCurrentFileAssignee(dossier.getId(), file.getId(), "2");
|
||||
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getWorkflowStatus()).isEqualTo(WorkflowStatus.UNDER_REVIEW);
|
||||
assertThat(loadedFile.getAssignee()).isEqualTo("2");
|
||||
assertThat(loadedFile.getLastReviewer()).isEqualTo("1");
|
||||
assertThat(loadedFile.getLastApprover()).isNull();
|
||||
|
||||
fileClient.setStatusUnderApproval(dossier.getId(), file.getId(), "2");
|
||||
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getWorkflowStatus()).isEqualTo(WorkflowStatus.UNDER_APPROVAL);
|
||||
assertThat(loadedFile.getAssignee()).isEqualTo("2");
|
||||
assertThat(loadedFile.getLastReviewer()).isEqualTo("2");
|
||||
assertThat(loadedFile.getLastApprover()).isNull();
|
||||
|
||||
fileClient.setCurrentFileAssignee(dossier.getId(), file.getId(), "1");
|
||||
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getWorkflowStatus()).isEqualTo(WorkflowStatus.UNDER_APPROVAL);
|
||||
assertThat(loadedFile.getAssignee()).isEqualTo("1");
|
||||
assertThat(loadedFile.getLastReviewer()).isEqualTo("2");
|
||||
assertThat(loadedFile.getLastApprover()).isEqualTo("2");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user