Skip to content

Commit

Permalink
Merge pull request #711 from ministryofjustice/APG-316-section-10-update
Browse files Browse the repository at this point in the history
(APG-316) Update Risks and Needs Section 10 - Emotional wellbeing
  • Loading branch information
jsrobertson authored Aug 19, 2024
2 parents dc990b5 + 8cc17ca commit 1915e91
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 17 deletions.
3 changes: 1 addition & 2 deletions integration_tests/mockApis/oasys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import type {
Health,
LearningNeeds,
OffenceDetail,
Psychiatric,
Referral,
RisksAndAlerts,
RoshAnalysis,
} from '@accredited-programmes/models'
import type { Lifestyle, Relationships } from '@accredited-programmes-api'
import type { Lifestyle, Psychiatric, Relationships } from '@accredited-programmes-api'

export default {
stubAssessmentDateInfo: (args: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CourseUtils, EmotionalWellbeingUtils } from '../../../../../server/utils'
import Page from '../../../page'
import type { Course, Psychiatric } from '@accredited-programmes/models'
import type { Course } from '@accredited-programmes/models'
import type { Psychiatric } from '@accredited-programmes-api'

export default class EmotionalWellbeing extends Page {
psychiatric: Psychiatric
Expand Down
6 changes: 0 additions & 6 deletions server/@types/models/Psychiatric.ts

This file was deleted.

2 changes: 0 additions & 2 deletions server/@types/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import type { Organisation } from './Organisation'
import type { OrganisationAddress } from './OrganisationAddress'
import type { Paginated } from './Paginated'
import type { KeyDates, Person, SentenceDetails } from './Person'
import type { Psychiatric } from './Psychiatric'
import type {
ConfirmationFields,
CreatedReferralResponse,
Expand Down Expand Up @@ -65,7 +64,6 @@ export type {
OrganisationAddress,
Paginated,
Person,
Psychiatric,
Referral,
ReferralStatus,
ReferralStatusCategory,
Expand Down
3 changes: 1 addition & 2 deletions server/data/accreditedProgrammesApi/oasysClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import type {
Health,
LearningNeeds,
OffenceDetail,
Psychiatric,
Referral,
RisksAndAlerts,
RoshAnalysis,
} from '@accredited-programmes/models'
import type { Lifestyle, Relationships } from '@accredited-programmes-api'
import type { Lifestyle, Psychiatric, Relationships } from '@accredited-programmes-api'
import type { SystemToken } from '@hmpps-auth'

export default class OasysClient {
Expand Down
3 changes: 1 addition & 2 deletions server/services/oasysService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import type {
Health,
LearningNeeds,
OffenceDetail,
Psychiatric,
Referral,
RisksAndAlerts,
RoshAnalysis,
} from '@accredited-programmes/models'
import type { Lifestyle, Relationships } from '@accredited-programmes-api'
import type { Lifestyle, Psychiatric, Relationships } from '@accredited-programmes-api'

export default class OasysService {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion server/testutils/factories/psychiatric.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Factory } from 'fishery'

import FactoryHelpers from './factoryHelpers'
import type { Psychiatric } from '@accredited-programmes/models'
import type { Psychiatric } from '@accredited-programmes-api'

export default Factory.define<Psychiatric>(() => {
const problemOptions = ['0-No problems', '1-Some problems']
Expand Down
4 changes: 4 additions & 0 deletions server/utils/risksAndNeeds/emotionalWellbeingUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ describe('EmotionalWellbeingUtils', () => {
describe('psychiatricSummaryListRows', () => {
it('formats phsychiatric data in the appropriate format for passing to a GOV.UK summary list Nunjucks macro', () => {
expect(EmotionalWellbeingUtils.psychiatricSummaryListRows(psychiatric)).toEqual([
{
key: { text: '10.1 - Difficulties coping' },
value: { text: '1-Some problems' },
},
{
key: { text: '10.2 - Current psychological problems or depression' },
value: { text: psychiatric.currPsychologicalProblems },
Expand Down
6 changes: 5 additions & 1 deletion server/utils/risksAndNeeds/emotionalWellbeingUtils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import ShowRisksAndNeedsUtils from '../referrals/showRisksAndNeedsUtils'
import type { Psychiatric } from '@accredited-programmes/models'
import type { GovukFrontendSummaryListRowWithKeyAndValue } from '@accredited-programmes/ui'
import type { Psychiatric } from '@accredited-programmes-api'

export default class EmotionalWellbeingUtils {
static psychiatricSummaryListRows(psychiatric: Psychiatric): Array<GovukFrontendSummaryListRowWithKeyAndValue> {
return [
{
key: { text: '10.1 - Difficulties coping' },
value: { text: ShowRisksAndNeedsUtils.textValue(psychiatric.difficultiesCoping) },
},
{
key: { text: '10.2 - Current psychological problems or depression' },
value: { text: ShowRisksAndNeedsUtils.textValue(psychiatric.currPsychologicalProblems) },
Expand Down

0 comments on commit 1915e91

Please sign in to comment.