diff --git a/progression-domain/progression-domain-aggregate/src/main/java/uk/gov/moj/cpp/progression/aggregate/CaseAggregate.java b/progression-domain/progression-domain-aggregate/src/main/java/uk/gov/moj/cpp/progression/aggregate/CaseAggregate.java index ada8d9357..7898fbf21 100644 --- a/progression-domain/progression-domain-aggregate/src/main/java/uk/gov/moj/cpp/progression/aggregate/CaseAggregate.java +++ b/progression-domain/progression-domain-aggregate/src/main/java/uk/gov/moj/cpp/progression/aggregate/CaseAggregate.java @@ -1725,13 +1725,19 @@ public Stream updateCase(final ProsecutionCase prosecutionCase, final Li } }); // LAA suppression of false proceedings concluded - if (isNotEmpty(defendantListForProceedingsConcludedEventTrigger) && isAllDefendantProceedingConcludedLaa(prosecutionCase, defendantListForProceedingsConcludedEventTrigger)) { - final UUID resultedHearingId = hearingId != null ? hearingId : latestHearingId; + final List defendantsForLaaProceedingsConcludedCheck = new ArrayList<>(); + if (isNotEmpty(defendantListForProceedingsConcludedEventTrigger) + && isAllDefendantProceedingConcludedLaa(prosecutionCase, defendantsForLaaProceedingsConcludedCheck)) { + final List defendantsWithLaaRepresentation = + getDefendantsWithLaaRepresentation(defendantListForProceedingsConcludedEventTrigger); + if (!defendantsWithLaaRepresentation.isEmpty()) { + final UUID resultedHearingId = hearingId != null ? hearingId : latestHearingId; streamBuilder.add(laaDefendantProceedingConcludedChanged() - .withDefendants(defendantListForProceedingsConcludedEventTrigger)//listOfDefendantsWithLaaRepresentation) + .withDefendants(defendantsWithLaaRepresentation) .withHearingId(resultedHearingId) .withProsecutionCaseId(prosecutionCase.getId()) .build()); + } } final String updatedCaseStatus = getUpdatedCaseStatus(prosecutionCase);