diff --git a/feature.env b/feature.env index 6692d1fe8..4816a6a4a 100644 --- a/feature.env +++ b/feature.env @@ -18,16 +18,20 @@ CASE_NOTES_API_URL=http://localhost:9091/casenotes INCENTIVES_API_URL=http://localhost:9091/incentives PATHFINDER_API_URL=http://localhost:9091/pathfinder MANAGE_SOC_CASES_API_URL=http://localhost:9091/soc +HMPPS_NON_ASSOCIATIONS_API_URL=http://localhost:9091/nonassociations OFFENDER_CATEGORISATION_UI_URL=http://localhost:9091/offendercategory USE_OF_FORCE_UI_URL=http://localhost:9091/useofforce MANAGE_A_WARRANT_FOLDER_UI_URL=http://localhost:9091/manageawarrant PATHFINDER_UI_URL=http://localhost:9091/pathfinderui MANAGE_SOC_CASES_UI_URL=http://localhost:9091/managesoccasesui +NON_ASSOCIATIONS_UI_URL=http://localhost:9091/nonassociationsui +NON_ASSOCIATIONS_PRISONS=MDI,LGI,FNI,ISI,RSI WELCOME_PEOPLE_INTO_PRISON_UI_URL=https://welcome-dev.prison.service.justice.gov.uk MANAGE_ADJUDICATIONS_API_URL=http://localhost:9091/adjudications CALCULATE_RELEASE_DATES_UI_URL=https://localhost:9091/calculateRelease FEEDBACK_DISABLED_PRISONS=LEI SYSTEM_PHASE=DEV NEURODIVERSITY_ENABLED_PRISONS=MDI -HMPPS_NON_ASSOCIATIONS_API_URL=http://localhost:9091/nonassociations + + diff --git a/helm_deploy/values-dev.yaml b/helm_deploy/values-dev.yaml index 75ce379cf..6da92145d 100644 --- a/helm_deploy/values-dev.yaml +++ b/helm_deploy/values-dev.yaml @@ -35,9 +35,11 @@ generic-service: CREATE_AND_VARY_A_LICENCE_UI_URL: "https://create-and-vary-a-licence-dev.hmpps.service.justice.gov.uk" MANAGE_ADJUDICATIONS_API_URL: "https://manage-adjudications-api-dev.hmpps.service.justice.gov.uk" CALCULATE_RELEASE_DATES_UI_URL: "https://calculate-release-dates-dev.hmpps.service.justice.gov.uk" + NON_ASSOCIATIONS_UI_URL: "https://non-associations-dev.hmpps.service.justice.gov.uk" FEEDBACK_DISABLED_PRISONS: "LEI,FNI,RSI,HMI,NHI" ENVIRONMENT_NAME: "DEV" NEURODIVERSITY_ENABLED_PRISONS: "BLI,NHI,LII,SLI" + NON_ASSOCIATIONS_PRISONS: "LGI,FNI,ISI,RSI" HMPPS_NON_ASSOCIATIONS_API_URL: "https://non-associations-api-dev.hmpps.service.justice.gov.uk" ACTIVITIES_URL: "https://activities-dev.prison.service.justice.gov.uk/activities" ACTIVITIES_ENABLED_PRISONS: "LEI,RSI" diff --git a/helm_deploy/values-preprod.yaml b/helm_deploy/values-preprod.yaml index df8aa18b8..f9237902f 100644 --- a/helm_deploy/values-preprod.yaml +++ b/helm_deploy/values-preprod.yaml @@ -35,9 +35,11 @@ generic-service: CREATE_AND_VARY_A_LICENCE_UI_URL: "https://create-and-vary-a-licence-preprod.hmpps.service.justice.gov.uk" MANAGE_ADJUDICATIONS_API_URL: "https://manage-adjudications-api-preprod.hmpps.service.justice.gov.uk" CALCULATE_RELEASE_DATES_UI_URL: "https://calculate-release-dates-preprod.hmpps.service.justice.gov.uk" + NON_ASSOCIATIONS_UI_URL: "https://non-associations-preprod.hmpps.service.justice.gov.uk" FEEDBACK_DISABLED_PRISONS: "LEI,FNI,RSI,HMI,NHI" ENVIRONMENT_NAME: "PRE-PRODUCTION" NEURODIVERSITY_ENABLED_PRISONS: "BLI,NHI,LII,SLI" + NON_ASSOCIATIONS_PRISONS: "LGI,FNI,ISI,RSI" HMPPS_NON_ASSOCIATIONS_API_URL: "https://non-associations-api-preprod.hmpps.service.justice.gov.uk" ACTIVITIES_URL: "https://activities-preprod.prison.service.justice.gov.uk/activities" ACTIVITIES_ENABLED_PRISONS: "" diff --git a/helm_deploy/values-prod.yaml b/helm_deploy/values-prod.yaml index 945353f35..10758f7cf 100644 --- a/helm_deploy/values-prod.yaml +++ b/helm_deploy/values-prod.yaml @@ -35,8 +35,10 @@ generic-service: CREATE_AND_VARY_A_LICENCE_UI_URL: "https://create-and-vary-a-licence.hmpps.service.justice.gov.uk" MANAGE_ADJUDICATIONS_API_URL: "https://manage-adjudications-api.hmpps.service.justice.gov.uk" CALCULATE_RELEASE_DATES_UI_URL: "https://calculate-release-dates.hmpps.service.justice.gov.uk" + NON_ASSOCIATIONS_UI_URL: "https://non-associations.hmpps.service.justice.gov.uk" FEEDBACK_DISABLED_PRISONS: "LEI,FNI,RSI,HMI,NHI" NEURODIVERSITY_ENABLED_PRISONS: "BLI,NHI,LII,SLI" + NON_ASSOCIATIONS_PRISONS: "" HMPPS_NON_ASSOCIATIONS_API_URL: "https://non-associations-api.hmpps.service.justice.gov.uk" ACTIVITIES_URL: "https://activities.prison.service.justice.gov.uk/activities" ACTIVITIES_ENABLED_PRISONS: "" diff --git a/readme/building_and_running.md b/readme/building_and_running.md index a9ed5afe8..38d74d118 100644 --- a/readme/building_and_running.md +++ b/readme/building_and_running.md @@ -69,6 +69,7 @@ USE_OF_FORCE_UI_URL=https://dev.use-of-force.service.justice.gov.uk MANAGE_A_WARRANT_FOLDER_UI_URL=https://manage-a-warrant-folder-dev.hmpps.service.justice.gov.uk PATHFINDER_UI_URL=https://dev.pathfinder.service.justice.gov.uk MANAGE_SOC_CASES_UI_URL=https://manage-soc-cases-dev.hmpps.service.justice.gov.uk +NON_ASSOCIATIONS_UI_URL: "https://non-associations-dev.hmpps.service.justice.gov.uk" ``` diff --git a/server/config.ts b/server/config.ts index ff549345e..b25e1b6ae 100755 --- a/server/config.ts +++ b/server/config.ts @@ -185,6 +185,7 @@ export default { calculateReleaseDates: get('CALCULATE_RELEASE_DATES_UI_URL', 'http://localhost:3001', requiredInProduction), activities: get('ACTIVITIES_URL', 'http://localhost:3001', requiredInProduction), appointments: get('APPOINTMENTS_URL', 'http://localhost:3001', requiredInProduction), + nonAssociations: get('NON_ASSOCIATIONS_UI_URL', 'http://localhost:3001', requiredInProduction), }, analytics: { tagManagerContainerId: get('TAG_MANAGER_CONTAINER_ID', ''), @@ -194,6 +195,7 @@ export default { feedbackDisabledPrisons: get('FEEDBACK_DISABLED_PRISONS', [], requiredInProduction), environmentName: get('ENVIRONMENT_NAME', ''), neurodiversityEnabledPrisons: process.env.NEURODIVERSITY_ENABLED_PRISONS || [], + nonAssociationsPrisons: process.env.NON_ASSOCIATIONS_PRISONS?.split(',') || [], activitiesEnabledPrisons: get('ACTIVITIES_ENABLED_PRISONS', [], requiredInProduction), appointmentsEnabledPrisons: get('APPOINTMENTS_ENABLED_PRISONS', [], requiredInProduction), } diff --git a/server/interfaces/overviewPage.ts b/server/interfaces/overviewPage.ts index f53a28425..8ef56068f 100644 --- a/server/interfaces/overviewPage.ts +++ b/server/interfaces/overviewPage.ts @@ -29,6 +29,8 @@ export interface OverviewNonAssociation { export interface AlertsSummary { activeAlertCount: number nonAssociationsCount: number + showNonAssociationsLink: boolean + nonAssociationsUrl: string } export interface OverviewPage { diff --git a/server/services/overviewPageService.test.ts b/server/services/overviewPageService.test.ts index 8eb717621..a579871ee 100644 --- a/server/services/overviewPageService.test.ts +++ b/server/services/overviewPageService.test.ts @@ -60,6 +60,7 @@ import { LearnerLatestAssessmentsMock } from '../data/localMockData/learnerLates import { LearnerGoalsMock } from '../data/localMockData/learnerGoalsMock' import { NonAssociationsApiClient } from '../data/interfaces/nonAssociationsApiClient' import movementsMock from '../data/localMockData/movementsData' +import config from '../config' describe('OverviewPageService', () => { let prisonApiClient: PrisonApiClient @@ -738,6 +739,8 @@ describe('OverviewPageService', () => { expect(res.alertsSummary).toEqual({ activeAlertCount: 1, nonAssociationsCount: 2, + nonAssociationsUrl: `${config.serviceUrls.nonAssociations}/prisoner/G6123VU/non-associations`, + showNonAssociationsLink: false, }) }) @@ -747,6 +750,44 @@ describe('OverviewPageService', () => { expect(res.alertsSummary).toEqual({ activeAlertCount: 1, nonAssociationsCount: 0, + nonAssociationsUrl: `${config.serviceUrls.nonAssociations}/prisoner/G6123VU/non-associations`, + showNonAssociationsLink: false, + }) + }) + + describe('Link to non-associations', () => { + describe('When non-associations is enabled for private beta', () => { + beforeEach(() => { + config.nonAssociationsPrisons = ['BAI', 'MDI'] + }) + + it('should show non-associations link', async () => { + const overviewPageService = overviewPageServiceConstruct() + const res = await overviewPageService.get('token', PrisonerMockDataA, 1, CaseLoadsDummyDataB, []) + expect(res.alertsSummary).toEqual({ + activeAlertCount: 1, + nonAssociationsCount: 0, + nonAssociationsUrl: `${config.serviceUrls.nonAssociations}/prisoner/G6123VU/non-associations`, + showNonAssociationsLink: true, + }) + }) + }) + + describe('When non-associations is disabled for private beta', () => { + beforeEach(() => { + config.nonAssociationsPrisons = ['MDI'] + }) + + it('should show non-associations link', async () => { + const overviewPageService = overviewPageServiceConstruct() + const res = await overviewPageService.get('token', PrisonerMockDataA, 1, CaseLoadsDummyDataB, []) + expect(res.alertsSummary).toEqual({ + activeAlertCount: 1, + nonAssociationsCount: 0, + nonAssociationsUrl: `${config.serviceUrls.nonAssociations}/prisoner/G6123VU/non-associations`, + showNonAssociationsLink: false, + }) + }) }) }) }) diff --git a/server/services/overviewPageService.ts b/server/services/overviewPageService.ts index 9a1c0cb15..7ce8dbea1 100644 --- a/server/services/overviewPageService.ts +++ b/server/services/overviewPageService.ts @@ -14,6 +14,7 @@ import { formatMoney, formatPrivilegedVisitsSummary, getNamesFromString, + nonAssociationsEnabled, prisonerBelongsToUsersCaseLoad, userHasRoles, } from '../utils/utils' @@ -535,7 +536,7 @@ export default class OverviewPageService { } private getAlertsSummary( - { activeAlertCount }: InmateDetail, + { activeAlertCount, offenderNo }: InmateDetail, nonAssociations: OverviewNonAssociation[], userCaseloads: CaseLoad[], ): AlertsSummary { @@ -543,8 +544,10 @@ export default class OverviewPageService { const nonAssociationsCount = nonAssociations.filter( nonAssociation => nonAssociation.agencyId === activeCaseload?.caseLoadId, ).length + const showNonAssociationsLink = nonAssociationsEnabled(activeCaseload?.caseLoadId) + const nonAssociationsUrl = `${config.serviceUrls.nonAssociations}/prisoner/${offenderNo}/non-associations` - return { activeAlertCount, nonAssociationsCount } + return { activeAlertCount, nonAssociationsCount, showNonAssociationsLink, nonAssociationsUrl } } private async getSchedule(prisonerData: Prisoner): Promise { diff --git a/server/utils/utils.ts b/server/utils/utils.ts index cdb142281..68c5ac257 100644 --- a/server/utils/utils.ts +++ b/server/utils/utils.ts @@ -468,6 +468,10 @@ export const neurodiversityEnabled = (agencyId: string): boolean => { return isEnabled } +export const nonAssociationsEnabled = (agencyId: string): boolean => { + return config.nonAssociationsPrisons?.includes(agencyId) +} + export const stripAgencyPrefix = (location: string, agency: string): string => { const parts = location && location.split('-') if (parts && parts.length > 0) { diff --git a/server/views/partials/overviewPage/alerts/alerts.njk b/server/views/partials/overviewPage/alerts/alerts.njk index 4a6b400ae..3bc5a32ba 100644 --- a/server/views/partials/overviewPage/alerts/alerts.njk +++ b/server/views/partials/overviewPage/alerts/alerts.njk @@ -14,6 +14,9 @@
Non-associations in {{ user.activeCaseLoad.description }}
{{ alertsSummary.nonAssociationsCount }}
+ {% if alertsSummary.showNonAssociationsLink %} +
Non-associations
+ {% endif %}