From 0246d3716a7b263377f3f21e781c46ba53d1df29 Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Tue, 13 Aug 2024 13:46:42 +0100 Subject: [PATCH] auto-approve action plans on submission from 2nd September 2024 (#1999) * auto-approve action plans on submission from 2nd September 2024 * ktlintFormat --- .../hmppsinterventionsservice/service/ActionPlanService.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/ActionPlanService.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/ActionPlanService.kt index 949d9af35..3120d9393 100644 --- a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/ActionPlanService.kt +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/ActionPlanService.kt @@ -16,6 +16,7 @@ import uk.gov.justice.digital.hmpps.hmppsinterventionsservice.jpa.repository.Act import uk.gov.justice.digital.hmpps.hmppsinterventionsservice.jpa.repository.AuthUserRepository import uk.gov.justice.digital.hmpps.hmppsinterventionsservice.jpa.repository.DeliverySessionRepository import uk.gov.justice.digital.hmpps.hmppsinterventionsservice.jpa.repository.ReferralRepository +import java.time.LocalDate import java.time.OffsetDateTime import java.util.UUID import java.util.UUID.randomUUID @@ -86,6 +87,11 @@ class ActionPlanService( val savedSubmittedActionPlan = actionPlanRepository.save(submittedActionPlan) actionPlanEventPublisher.actionPlanSubmitEvent(savedSubmittedActionPlan) + // if after 2nd september, auto-approve + if (LocalDate.now().isAfter(LocalDate.of(2024, 9, 1))) { + approveActionPlan(id, AuthUser.interventionsServiceUser) + } + return savedSubmittedActionPlan }