diff --git a/integration_tests/mockApis/oasys.ts b/integration_tests/mockApis/oasys.ts index 5078e6536..ee91add47 100644 --- a/integration_tests/mockApis/oasys.ts +++ b/integration_tests/mockApis/oasys.ts @@ -5,7 +5,6 @@ import { stubFor } from '../../wiremock' import type { AssessmentDateInfo, Attitude, - Behaviour, DrugAlcoholDetail, Health, LearningNeeds, @@ -14,7 +13,7 @@ import type { RisksAndAlerts, RoshAnalysis, } from '@accredited-programmes/models' -import type { Lifestyle, Psychiatric, Relationships } from '@accredited-programmes-api' +import type { Behaviour, Lifestyle, Psychiatric, Relationships } from '@accredited-programmes-api' export default { stubAssessmentDateInfo: (args: { diff --git a/integration_tests/pages/shared/showReferral/risksAndNeeds/thinkingAndBehaving.ts b/integration_tests/pages/shared/showReferral/risksAndNeeds/thinkingAndBehaving.ts index 32aefc9aa..a1164c719 100644 --- a/integration_tests/pages/shared/showReferral/risksAndNeeds/thinkingAndBehaving.ts +++ b/integration_tests/pages/shared/showReferral/risksAndNeeds/thinkingAndBehaving.ts @@ -1,6 +1,7 @@ import { CourseUtils, ThinkingAndBehavingUtils } from '../../../../../server/utils' import Page from '../../../page' -import type { Behaviour, Course } from '@accredited-programmes/models' +import type { Course } from '@accredited-programmes/models' +import type { Behaviour } from '@accredited-programmes-api' export default class ThinkingAndBehavingPage extends Page { behaviour: Behaviour diff --git a/server/@types/models/Behaviour.ts b/server/@types/models/Behaviour.ts deleted file mode 100644 index aec70786e..000000000 --- a/server/@types/models/Behaviour.ts +++ /dev/null @@ -1,8 +0,0 @@ -export type Behaviour = { - achieveGoals?: string - awarenessOfConsequences?: string - concreteAbstractThinking?: string - problemSolvingSkills?: string - temperControl?: string - understandsViewsOfOthers?: string -} diff --git a/server/@types/models/index.d.ts b/server/@types/models/index.d.ts index d9cc4c275..30b882688 100644 --- a/server/@types/models/index.d.ts +++ b/server/@types/models/index.d.ts @@ -1,6 +1,5 @@ import type { AssessmentDateInfo } from './AssessmentDateInfo' import type { Attitude } from './Attitude' -import type { Behaviour } from './Behaviour' import type { Course } from './Course' import type { Audience, CourseAudience } from './CourseAudience' import type { CourseCreateRequest } from './CourseCreateRequest' @@ -43,7 +42,6 @@ export type { AssessmentDateInfo, Attitude, Audience, - Behaviour, ConfirmationFields, Course, CourseAudience, diff --git a/server/data/accreditedProgrammesApi/oasysClient.ts b/server/data/accreditedProgrammesApi/oasysClient.ts index 76f172797..ad0941b99 100644 --- a/server/data/accreditedProgrammesApi/oasysClient.ts +++ b/server/data/accreditedProgrammesApi/oasysClient.ts @@ -5,7 +5,6 @@ import RestClient from '../restClient' import type { AssessmentDateInfo, Attitude, - Behaviour, DrugAlcoholDetail, Health, LearningNeeds, @@ -14,7 +13,7 @@ import type { RisksAndAlerts, RoshAnalysis, } from '@accredited-programmes/models' -import type { Lifestyle, Psychiatric, Relationships } from '@accredited-programmes-api' +import type { Behaviour, Lifestyle, Psychiatric, Relationships } from '@accredited-programmes-api' import type { SystemToken } from '@hmpps-auth' export default class OasysClient { diff --git a/server/services/oasysService.ts b/server/services/oasysService.ts index 6269f9152..ec5081573 100644 --- a/server/services/oasysService.ts +++ b/server/services/oasysService.ts @@ -5,7 +5,6 @@ import type { HmppsAuthClient, OasysClient, RestClientBuilder, RestClientBuilder import type { AssessmentDateInfo, Attitude, - Behaviour, DrugAlcoholDetail, Health, LearningNeeds, @@ -14,7 +13,7 @@ import type { RisksAndAlerts, RoshAnalysis, } from '@accredited-programmes/models' -import type { Lifestyle, Psychiatric, Relationships } from '@accredited-programmes-api' +import type { Behaviour, Lifestyle, Psychiatric, Relationships } from '@accredited-programmes-api' export default class OasysService { constructor( diff --git a/server/testutils/factories/behaviour.ts b/server/testutils/factories/behaviour.ts index cb7c76dd9..ecbeddbfb 100644 --- a/server/testutils/factories/behaviour.ts +++ b/server/testutils/factories/behaviour.ts @@ -2,14 +2,18 @@ import { faker } from '@faker-js/faker' import { Factory } from 'fishery' import FactoryHelpers from './factoryHelpers' -import type { Behaviour } from '@accredited-programmes/models' +import type { Behaviour } from '@accredited-programmes-api' export default Factory.define(() => { return { achieveGoals: FactoryHelpers.optionalArrayElement(faker.lorem.sentence()), + aggressiveControllingBehaviour: FactoryHelpers.optionalArrayElement(faker.lorem.sentence()), awarenessOfConsequences: FactoryHelpers.optionalArrayElement(faker.lorem.sentence()), concreteAbstractThinking: FactoryHelpers.optionalArrayElement(faker.lorem.sentence()), + impulsivity: FactoryHelpers.optionalArrayElement(faker.lorem.sentence()), + offenceRelatedSexualInterests: FactoryHelpers.optionalArrayElement(faker.lorem.sentence()), problemSolvingSkills: FactoryHelpers.optionalArrayElement(faker.lorem.sentence()), + sexualPreOccupation: FactoryHelpers.optionalArrayElement(faker.lorem.sentence()), temperControl: FactoryHelpers.optionalArrayElement(faker.lorem.sentence()), understandsViewsOfOthers: FactoryHelpers.optionalArrayElement(faker.lorem.sentence()), } diff --git a/server/utils/risksAndNeeds/thinkingAndBehavingUtils.test.ts b/server/utils/risksAndNeeds/thinkingAndBehavingUtils.test.ts index b59abccd5..8a58a8a7e 100644 --- a/server/utils/risksAndNeeds/thinkingAndBehavingUtils.test.ts +++ b/server/utils/risksAndNeeds/thinkingAndBehavingUtils.test.ts @@ -2,29 +2,41 @@ import ThinkingAndBehavingUtils from './thinkingAndBehavingUtils' import { behaviourFactory } from '../../testutils/factories' describe('ThinkingAndBehavingUtils', () => { - const roshAnalysis = behaviourFactory.build({ + const behaviour = behaviourFactory.build({ achieveGoals: '1 - Some problems', - awarenessOfConsequences: '2 - Some problems', - concreteAbstractThinking: '3 - Some problems', - problemSolvingSkills: '4 - Some problems', - temperControl: '5 - Some problems', - understandsViewsOfOthers: '6 - Some problems', + aggressiveControllingBehaviour: '2 - Some problems', + awarenessOfConsequences: '3 - Some problems', + concreteAbstractThinking: '4 - Some problems', + impulsivity: '5 - Some problems', + offenceRelatedSexualInterests: '6 - Some problems', + problemSolvingSkills: '7 - Some problems', + sexualPreOccupation: '8 - Some problems', + temperControl: '9 - Some problems', + understandsViewsOfOthers: '10 - Some problems', }) describe('previousBehaviourSummaryListRows', () => { it('formats the behaviour data in the appropriate format for passing to a GOV.UK summary list Nunjucks macro', () => { - expect(ThinkingAndBehavingUtils.thinkingAndBehavingSummaryListRows(roshAnalysis)).toEqual([ + expect(ThinkingAndBehavingUtils.thinkingAndBehavingSummaryListRows(behaviour)).toEqual([ { - key: { text: '11.4 - Temper control' }, + key: { text: '11.2 - Impulsivity' }, value: { text: '5 - Some problems' }, }, + { + key: { text: '11.3 - Aggressive or controlling behaviour' }, + value: { text: '2 - Some problems' }, + }, + { + key: { text: '11.4 - Temper control' }, + value: { text: '9 - Some problems' }, + }, { key: { text: '11.6 - Problem solving skills' }, - value: { text: '4 - Some problems' }, + value: { text: '7 - Some problems' }, }, { key: { text: '11.7 - Awareness of consequences' }, - value: { text: '2 - Some problems' }, + value: { text: '3 - Some problems' }, }, { key: { text: '11.8 - Achieves goals (optional)' }, @@ -32,11 +44,19 @@ describe('ThinkingAndBehavingUtils', () => { }, { key: { text: "11.9 - Understands other people's views" }, - value: { text: '6 - Some problems' }, + value: { text: '10 - Some problems' }, }, { - key: { text: '11.10 - Concrete / abstract thinking (optional)' }, - value: { text: '3 - Some problems' }, + key: { text: '11.10 - Concrete or abstract thinking (optional)' }, + value: { text: '4 - Some problems' }, + }, + { + key: { text: '11.11 - Sexual preoccupation' }, + value: { text: '8 - Some problems' }, + }, + { + key: { text: '11.12 - Offence-related sexual interests' }, + value: { text: '6 - Some problems' }, }, ]) }) diff --git a/server/utils/risksAndNeeds/thinkingAndBehavingUtils.ts b/server/utils/risksAndNeeds/thinkingAndBehavingUtils.ts index 9a9f34e02..98bd5caf3 100644 --- a/server/utils/risksAndNeeds/thinkingAndBehavingUtils.ts +++ b/server/utils/risksAndNeeds/thinkingAndBehavingUtils.ts @@ -1,10 +1,18 @@ import ShowRisksAndNeedsUtils from '../referrals/showRisksAndNeedsUtils' -import type { Behaviour } from '@accredited-programmes/models' import type { GovukFrontendSummaryListRowWithKeyAndValue } from '@accredited-programmes/ui' +import type { Behaviour } from '@accredited-programmes-api' export default class ThinkingAndBehavingUtils { static thinkingAndBehavingSummaryListRows(behaviour: Behaviour): Array { return [ + { + key: { text: '11.2 - Impulsivity' }, + value: { text: ShowRisksAndNeedsUtils.textValue(behaviour.impulsivity) }, + }, + { + key: { text: '11.3 - Aggressive or controlling behaviour' }, + value: { text: ShowRisksAndNeedsUtils.textValue(behaviour.aggressiveControllingBehaviour) }, + }, { key: { text: '11.4 - Temper control' }, value: { text: ShowRisksAndNeedsUtils.textValue(behaviour.temperControl) }, @@ -26,9 +34,17 @@ export default class ThinkingAndBehavingUtils { value: { text: ShowRisksAndNeedsUtils.textValue(behaviour.understandsViewsOfOthers) }, }, { - key: { text: '11.10 - Concrete / abstract thinking (optional)' }, + key: { text: '11.10 - Concrete or abstract thinking (optional)' }, value: { text: ShowRisksAndNeedsUtils.textValue(behaviour.concreteAbstractThinking) }, }, + { + key: { text: '11.11 - Sexual preoccupation' }, + value: { text: ShowRisksAndNeedsUtils.textValue(behaviour.sexualPreOccupation) }, + }, + { + key: { text: '11.12 - Offence-related sexual interests' }, + value: { text: ShowRisksAndNeedsUtils.textValue(behaviour.offenceRelatedSexualInterests) }, + }, ] } }