From 1d1a37eeb2ad96f40ca5177f6a3889b44dc65d1a Mon Sep 17 00:00:00 2001 From: Gurnank Date: Sun, 28 Apr 2024 10:37:55 +0100 Subject: [PATCH] MAP-961 change baton and pava question wording --- .../createIncident/view-your-report.cy.js | 47 ++++++++++++++ .../enter-use-of-force-details.cy.js | 22 +++---- integration-tests/integration/seedData.js | 4 +- .../createReport/useOfForceDetailsPage.js | 10 +-- .../pages/sections/reportDetails.js | 4 +- .../pages/yourReports/yourReportPage.js | 8 +++ server/config/forms/useOfForceDetailsForm.js | 18 +++--- .../forms/useOfForceDetailsValidation.test.js | 62 +++++++++---------- server/data/UseOfForceReport.ts | 6 +- .../creatingReports/checkYourAnswers.test.ts | 16 ++--- .../creatingReports/createReport.test.ts | 19 +++--- .../drafts/reportStatusChecker.test.ts | 8 +-- server/services/reportDetailBuilder.test.ts | 4 +- server/services/reportSummary.ts | 6 ++ .../formPages/incident/useOfForceDetails.html | 16 ++--- server/views/pages/reportDetailMacro.njk | 24 +++++++ 16 files changed, 184 insertions(+), 90 deletions(-) diff --git a/integration-tests/integration/createIncident/view-your-report.cy.js b/integration-tests/integration/createIncident/view-your-report.cy.js index e67458ec..89bf3552 100644 --- a/integration-tests/integration/createIncident/view-your-report.cy.js +++ b/integration-tests/integration/createIncident/view-your-report.cy.js @@ -134,5 +134,52 @@ context('A reporter views their own report', () => { const yourReportPage = YourReportPage.verifyOnPage() yourReportPage.location().contains('–') + yourReportPage.batonDrawnAgainstPrisonerLabel().contains('Was a baton drawn against the prisoner?') + yourReportPage.pavaDrawnAgainstPrisonerLabel().contains('Was PAVA drawn against the prisoner?') + }) + + it('A user can view their own report with the old version of the Baton and PAVA questions', () => { + cy.task('stubLocationNotFound', '357591') + + cy.login() + + expectedPayload.useOfForceDetails.batonDrawnAgainstPrisoner = undefined + expectedPayload.useOfForceDetails.pavaDrawnAgainstPrisoner = undefined + expectedPayload.useOfForceDetails.batonDrawn = true + expectedPayload.useOfForceDetails.pavaDrawn = true + + cy.task('seedReport', { + status: ReportStatus.SUBMITTED, + submittedDate: '2019-09-04 11:27:52', + involvedStaff: [ + { + username: 'MR_ZAGATO', + name: 'MR_ZAGATO name', + email: 'MR_ZAGATO@gov.uk', + }, + { + username: 'MRS_JONES', + name: 'MRS_JONES name', + email: 'MR_ZAGATO@gov.uk', + }, + { + username: 'TEST_USER', + name: 'TEST_USER name', + email: 'TEST_USER@gov.uk', + }, + ], + payload: expectedPayload, + }) + + const yourStatementsPage = YourStatementsPage.goTo() + yourStatementsPage.yourReportsTab().click() + + const yourReportsPage = YourReportsPage.verifyOnPage() + yourReportsPage.reports(0).action().click() + + const yourReportPage = YourReportPage.verifyOnPage() + yourReportPage.location().contains('–') + yourReportPage.batonDrawnLabel().contains('Was a baton drawn by anyone during this incident?') + yourReportPage.pavaDrawnLabel().contains('Was PAVA drawn by anyone during this incident?') }) }) diff --git a/integration-tests/integration/reportPages/enter-use-of-force-details.cy.js b/integration-tests/integration/reportPages/enter-use-of-force-details.cy.js index 3b117c5f..84b6fc05 100644 --- a/integration-tests/integration/reportPages/enter-use-of-force-details.cy.js +++ b/integration-tests/integration/reportPages/enter-use-of-force-details.cy.js @@ -27,11 +27,11 @@ context('Enter use of force details page', () => { useOfForceDetailsPage.bodyWornCameraNumber(1).type('345') useOfForceDetailsPage.removeBodyWornCamera(0) useOfForceDetailsPage.personalProtectionTechniques().check('true') - useOfForceDetailsPage.batonDrawn().check('true') + useOfForceDetailsPage.batonDrawnAgainstPrisoner().check('true') useOfForceDetailsPage.batonUsed().check('true') - useOfForceDetailsPage.pavaDrawn().check('true') - useOfForceDetailsPage.weaponsObserved().check('NO') + useOfForceDetailsPage.pavaDrawnAgainstPrisoner().check('true') useOfForceDetailsPage.pavaUsed().check('true') + useOfForceDetailsPage.weaponsObserved().check('NO') useOfForceDetailsPage.guidingHold().check('true') useOfForceDetailsPage.guidingHoldOfficersInvolved.check('2') useOfForceDetailsPage.escortingHold().check('true') @@ -51,13 +51,13 @@ context('Enter use of force details page', () => { expect(section).to.deep.equal({ bodyWornCamera: 'YES', bodyWornCameraNumbers: [{ cameraNum: '345' }], - batonDrawn: true, + batonDrawnAgainstPrisoner: true, batonUsed: true, guidingHold: true, guidingHoldOfficersInvolved: 2, escortingHold: true, handcuffsApplied: true, - pavaDrawn: true, + pavaDrawnAgainstPrisoner: true, pavaUsed: true, weaponsObserved: 'NO', personalProtectionTechniques: true, @@ -77,13 +77,13 @@ context('Enter use of force details page', () => { expect(section).to.deep.equal({ bodyWornCamera: 'YES', bodyWornCameraNumbers: [{ cameraNum: '345' }], - batonDrawn: true, + batonDrawnAgainstPrisoner: true, batonUsed: true, guidingHold: true, guidingHoldOfficersInvolved: 2, escortingHold: true, handcuffsApplied: true, - pavaDrawn: true, + pavaDrawnAgainstPrisoner: true, weaponsObserved: 'NO', pavaUsed: true, personalProtectionTechniques: true, @@ -105,9 +105,9 @@ context('Enter use of force details page', () => { useOfForceDetailsPage.bodyWornCamera().should('have.value', 'YES') useOfForceDetailsPage.bodyWornCameraNumber(0).should('have.value', '345') useOfForceDetailsPage.personalProtectionTechniques().should('have.value', 'true') - useOfForceDetailsPage.batonDrawn().should('have.value', 'true') + useOfForceDetailsPage.batonDrawnAgainstPrisoner().should('have.value', 'true') useOfForceDetailsPage.batonUsed().should('have.value', 'true') - useOfForceDetailsPage.pavaDrawn().should('have.value', 'true') + useOfForceDetailsPage.pavaDrawnAgainstPrisoner().should('have.value', 'true') useOfForceDetailsPage.pavaUsed().should('have.value', 'true') useOfForceDetailsPage.guidingHold().should('have.value', 'true') useOfForceDetailsPage.guidingHoldOfficersInvolved.two().should('be.checked') @@ -132,7 +132,7 @@ context('Enter use of force details page', () => { const useOfForceDetailsPage = UseOfForceDetailsPage.verifyOnPage() useOfForceDetailsPage.positiveCommunication().check('true') useOfForceDetailsPage.personalProtectionTechniques().check('true') - useOfForceDetailsPage.pavaDrawn().check('true') + useOfForceDetailsPage.pavaDrawnAgainstPrisoner().check('true') useOfForceDetailsPage.pavaUsed().check('true') useOfForceDetailsPage.guidingHold().check('true') useOfForceDetailsPage.guidingHoldOfficersInvolved.check('2') @@ -159,7 +159,7 @@ context('Enter use of force details page', () => { useOfForceDetailsPage.positiveCommunication().check('true') useOfForceDetailsPage.bodyWornCamera().check('YES') useOfForceDetailsPage.personalProtectionTechniques().check('true') - useOfForceDetailsPage.pavaDrawn().check('true') + useOfForceDetailsPage.pavaDrawnAgainstPrisoner().check('true') useOfForceDetailsPage.pavaUsed().check('true') useOfForceDetailsPage.weaponsObserved().check('YES') useOfForceDetailsPage.guidingHold().check('true') diff --git a/integration-tests/integration/seedData.js b/integration-tests/integration/seedData.js index 4658b42c..7f68350e 100644 --- a/integration-tests/integration/seedData.js +++ b/integration-tests/integration/seedData.js @@ -27,10 +27,10 @@ const expectedPayload = { bodyWornCameraNumbers: [{ cameraNum: '123' }, { cameraNum: '789' }, { cameraNum: '456' }], pavaUsed: true, batonUsed: true, - pavaDrawn: true, weaponsObserved: 'YES', weaponTypes: [{ weaponType: 'gun' }, { weaponType: 'knife' }, { weaponType: 'fork' }], - batonDrawn: true, + batonDrawnAgainstPrisoner: true, + pavaDrawnAgainstPrisoner: true, guidingHold: true, escortingHold: true, handcuffsApplied: true, diff --git a/integration-tests/pages/createReport/useOfForceDetailsPage.js b/integration-tests/pages/createReport/useOfForceDetailsPage.js index 2b233194..26b46a97 100644 --- a/integration-tests/pages/createReport/useOfForceDetailsPage.js +++ b/integration-tests/pages/createReport/useOfForceDetailsPage.js @@ -12,13 +12,13 @@ const useOfForceDetailsPage = () => cy.get('.add-another-body-worn-camera .add-another__remove-button').eq(index).click(), personalProtectionTechniques: () => cy.get('[name="personalProtectionTechniques"]'), - batonDrawn: () => cy.get('[name="batonDrawn"]'), + batonDrawnAgainstPrisoner: () => cy.get('[name="batonDrawnAgainstPrisoner"]'), batonUsed: () => cy.get('[name="batonUsed"]'), - pavaDrawn: () => cy.get('[name="pavaDrawn"]'), + pavaDrawnAgainstPrisoner: () => cy.get('[name="pavaDrawnAgainstPrisoner"]'), + pavaUsed: () => cy.get('[name="pavaUsed"]'), weaponsObserved: () => cy.get('[name="weaponsObserved"]'), weaponTypes: index => cy.get(`[name="weaponTypes[${index}][weaponType]"]`), addAnotherWeapon: () => cy.get('[dataqa=add-another-weapons-observed]').click(), - pavaUsed: () => cy.get('[name="pavaUsed"]'), guidingHold: () => cy.get('[name="guidingHold"]'), guidingHoldOfficersInvolved: { check: value => cy.get('[name="guidingHoldOfficersInvolved"]').check(value), @@ -57,9 +57,9 @@ const useOfForceDetailsPage = () => this.positiveCommunication().check('true') this.bodyWornCamera().check('NO') this.personalProtectionTechniques().check('true') - this.batonDrawn().check('true') + this.batonDrawnAgainstPrisoner().check('true') this.batonUsed().check('true') - this.pavaDrawn().check('true') + this.pavaDrawnAgainstPrisoner().check('true') this.pavaUsed().check('true') this.weaponsObserved().check('NO') this.guidingHold().check('true') diff --git a/integration-tests/pages/sections/reportDetails.js b/integration-tests/pages/sections/reportDetails.js index ce3df7f1..d1f3367e 100644 --- a/integration-tests/pages/sections/reportDetails.js +++ b/integration-tests/pages/sections/reportDetails.js @@ -57,8 +57,8 @@ module.exports = { positiveCommunicationUsed().contains('Yes') cy.get('[data-qa="personalProtection"]').contains('Yes') - cy.get('[data-qa="batonDrawn"]').contains('Yes and used') - cy.get('[data-qa="pavaDrawn"]').contains('Yes and used') + cy.get('[data-qa="batonDrawnAgainstPrisoner"]').contains('Yes and used') + cy.get('[data-qa="pavaDrawnAgainstPrisoner"]').contains('Yes and used') cy.get('[data-qa="guidingHold"]').contains('Yes - 2 officers involved') cy.get('[data-qa="escortingHold"]').contains('Yes') cy.get('[data-qa="restraintUsed"]').contains('Standing') diff --git a/integration-tests/pages/yourReports/yourReportPage.js b/integration-tests/pages/yourReports/yourReportPage.js index e02f28ac..2bd007ab 100644 --- a/integration-tests/pages/yourReports/yourReportPage.js +++ b/integration-tests/pages/yourReports/yourReportPage.js @@ -17,6 +17,14 @@ const viewYourReportPage = () => location: () => cy.get('[data-qa="location"]'), + batonDrawnLabel: () => cy.get('[data-qa="batonDrawn"]').parent(), + + batonDrawnAgainstPrisonerLabel: () => cy.get('[data-qa="batonDrawnAgainstPrisoner"]').parent(), + + pavaDrawnLabel: () => cy.get('[data-qa="pavaDrawn"]').parent(), + + pavaDrawnAgainstPrisonerLabel: () => cy.get('[data-qa="pavaDrawnAgainstPrisoner"]').parent(), + verifyInputs: reportDetails.verifyInputs, useOfForcePlanned: reportDetails.useOfForcePlanned, diff --git a/server/config/forms/useOfForceDetailsForm.js b/server/config/forms/useOfForceDetailsForm.js index 5ca5c200..1375f77c 100644 --- a/server/config/forms/useOfForceDetailsForm.js +++ b/server/config/forms/useOfForceDetailsForm.js @@ -43,15 +43,21 @@ const completeSchema = joi.object({ optionalForPartialValidation ), - batonDrawn: requiredBooleanMsg('Select yes if a baton was drawn').alter(optionalForPartialValidation), + batonDrawnAgainstPrisoner: requiredBooleanMsg('Select yes if a baton was drawn').alter(optionalForPartialValidation), - batonUsed: joi.when('batonDrawn', { + batonUsed: joi.when('batonDrawnAgainstPrisoner', { is: true, then: requiredBooleanMsg('Select yes if a baton was used').alter(optionalForPartialValidation), otherwise: joi.any().strip(), }), - pavaDrawn: requiredBooleanMsg('Select yes if PAVA was drawn').alter(optionalForPartialValidation), + pavaDrawnAgainstPrisoner: requiredBooleanMsg('Select yes if PAVA was drawn').alter(optionalForPartialValidation), + + pavaUsed: joi.when('pavaDrawnAgainstPrisoner', { + is: true, + then: requiredBooleanMsg('Select yes if PAVA was used').alter(optionalForPartialValidation), + otherwise: joi.any().strip(), + }), weaponsObserved: requiredOneOfMsg( 'YES', @@ -72,12 +78,6 @@ const completeSchema = joi.object({ }) .meta({ firstFieldName: 'weaponTypes[0]' }), - pavaUsed: joi.when('pavaDrawn', { - is: true, - then: requiredBooleanMsg('Select yes if PAVA was used').alter(optionalForPartialValidation), - otherwise: joi.any().strip(), - }), - guidingHold: requiredBooleanMsg('Select yes if a guiding hold was used').alter(optionalForPartialValidation), guidingHoldOfficersInvolved: joi.when('guidingHold', { diff --git a/server/config/forms/useOfForceDetailsValidation.test.js b/server/config/forms/useOfForceDetailsValidation.test.js index 9a0a4cf9..6df9b99f 100644 --- a/server/config/forms/useOfForceDetailsValidation.test.js +++ b/server/config/forms/useOfForceDetailsValidation.test.js @@ -14,11 +14,11 @@ beforeEach(() => { positiveCommunication: 'true', bodyWornCamera: 'NO', personalProtectionTechniques: 'true', - batonDrawn: 'true', + batonDrawnAgainstPrisoner: 'true', batonUsed: 'true', - pavaDrawn: 'true', - weaponsObserved: 'NO', + pavaDrawnAgainstPrisoner: 'true', pavaUsed: 'true', + weaponsObserved: 'NO', guidingHold: 'true', guidingHoldOfficersInvolved: '2', escortingHold: 'true', @@ -42,9 +42,9 @@ describe('complete schema', () => { positiveCommunication: true, bodyWornCamera: 'NO', personalProtectionTechniques: true, - batonDrawn: true, + batonDrawnAgainstPrisoner: true, batonUsed: true, - pavaDrawn: true, + pavaDrawnAgainstPrisoner: true, pavaUsed: true, weaponsObserved: 'NO', guidingHold: true, @@ -74,11 +74,11 @@ describe('complete schema', () => { text: 'Select yes if any personal protection techniques were used', }, { - href: '#batonDrawn', + href: '#batonDrawnAgainstPrisoner', text: 'Select yes if a baton was drawn', }, { - href: '#pavaDrawn', + href: '#pavaDrawnAgainstPrisoner', text: 'Select yes if PAVA was drawn', }, { href: '#weaponsObserved', text: 'Select yes if any weapons were observed' }, @@ -177,7 +177,7 @@ describe('complete schema', () => { expect(errors).toEqual([]) expect(formResponse).toEqual({ - batonDrawn: true, + batonDrawnAgainstPrisoner: true, batonUsed: true, bodyWornCamera: 'YES', bodyWornCameraNumbers: [ @@ -193,7 +193,7 @@ describe('complete schema', () => { guidingHoldOfficersInvolved: 2, handcuffsApplied: true, painInducingTechniquesUsed: ['FINAL_LOCK_FLEXION', 'THUMB_LOCK'], - pavaDrawn: true, + pavaDrawnAgainstPrisoner: true, weaponsObserved: 'NO', pavaUsed: true, personalProtectionTechniques: true, @@ -211,7 +211,7 @@ describe('complete schema', () => { expect(errors).toEqual([]) expect(formResponse).toEqual({ - batonDrawn: true, + batonDrawnAgainstPrisoner: true, batonUsed: true, bodyWornCamera: 'NO', escortingHold: true, @@ -219,7 +219,7 @@ describe('complete schema', () => { guidingHoldOfficersInvolved: 2, handcuffsApplied: true, painInducingTechniquesUsed: ['FINAL_LOCK_FLEXION', 'THUMB_LOCK'], - pavaDrawn: true, + pavaDrawnAgainstPrisoner: true, weaponsObserved: 'NO', pavaUsed: true, personalProtectionTechniques: true, @@ -241,7 +241,7 @@ describe('complete schema', () => { ]) expect(formResponse).toEqual({ - batonDrawn: true, + batonDrawnAgainstPrisoner: true, batonUsed: true, bodyWornCamera: 'SOMETHING_RANDOM', escortingHold: true, @@ -249,7 +249,7 @@ describe('complete schema', () => { guidingHoldOfficersInvolved: 2, handcuffsApplied: true, painInducingTechniquesUsed: ['FINAL_LOCK_FLEXION', 'THUMB_LOCK'], - pavaDrawn: true, + pavaDrawnAgainstPrisoner: true, weaponsObserved: 'NO', pavaUsed: true, personalProtectionTechniques: true, @@ -274,17 +274,17 @@ describe('complete schema', () => { it("Not selecting an option for 'baton drawn' returns validation error message plus Baton Used is undefined", () => { const input = { ...validInput, - batonDrawn: undefined, + batonDrawnAgainstPrisoner: undefined, } const { errors, formResponse } = check(input) expect(errors).toEqual([ { - href: '#batonDrawn', + href: '#batonDrawnAgainstPrisoner', text: 'Select yes if a baton was drawn', }, ]) - expect(formResponse.batonDrawn).toBe(undefined) + expect(formResponse.batonDrawnAgainstPrisoner).toBe(undefined) expect(formResponse.batonUsed).toBe(undefined) }) @@ -301,24 +301,24 @@ describe('complete schema', () => { text: 'Select yes if a baton was used', }, ]) - expect(formResponse.batonDrawn).toEqual(true) + expect(formResponse.batonDrawnAgainstPrisoner).toEqual(true) expect(formResponse.batonUsed).toBe(undefined) }) it("Not selecting an option for 'pava drawn' returns validation error message plus 'pava used' is undefined", () => { const input = { ...validInput, - pavaDrawn: undefined, + pavaDrawnAgainstPrisoner: undefined, } const { errors, formResponse } = check(input) expect(errors).toEqual([ { - href: '#pavaDrawn', + href: '#pavaDrawnAgainstPrisoner', text: 'Select yes if PAVA was drawn', }, ]) - expect(formResponse.pavaDrawn).toEqual(undefined) + expect(formResponse.pavaDrawnAgainstPrisoner).toEqual(undefined) expect(formResponse.pavaUsed).toBe(undefined) }) @@ -335,7 +335,7 @@ describe('complete schema', () => { text: 'Select yes if PAVA was used', }, ]) - expect(formResponse.pavaDrawn).toEqual(true) + expect(formResponse.pavaDrawnAgainstPrisoner).toEqual(true) expect(formResponse.pavaUsed).toBe(undefined) }) @@ -377,7 +377,7 @@ describe('complete schema', () => { expect(errors).toEqual([]) expect(formResponse).toEqual({ - batonDrawn: true, + batonDrawnAgainstPrisoner: true, batonUsed: true, bodyWornCamera: 'NO', escortingHold: true, @@ -385,7 +385,7 @@ describe('complete schema', () => { guidingHoldOfficersInvolved: 2, handcuffsApplied: true, painInducingTechniquesUsed: ['FINAL_LOCK_FLEXION', 'THUMB_LOCK'], - pavaDrawn: true, + pavaDrawnAgainstPrisoner: true, pavaUsed: true, personalProtectionTechniques: true, positiveCommunication: true, @@ -411,7 +411,7 @@ describe('complete schema', () => { expect(errors).toEqual([]) expect(formResponse).toEqual({ - batonDrawn: true, + batonDrawnAgainstPrisoner: true, batonUsed: true, bodyWornCamera: 'NO', weaponsObserved: 'NO', @@ -420,7 +420,7 @@ describe('complete schema', () => { guidingHoldOfficersInvolved: 2, handcuffsApplied: true, painInducingTechniquesUsed: ['FINAL_LOCK_FLEXION', 'THUMB_LOCK'], - pavaDrawn: true, + pavaDrawnAgainstPrisoner: true, pavaUsed: true, personalProtectionTechniques: true, positiveCommunication: true, @@ -620,9 +620,9 @@ describe('partial schema', () => { positiveCommunication: true, bodyWornCamera: 'NO', personalProtectionTechniques: true, - batonDrawn: true, + batonDrawnAgainstPrisoner: true, batonUsed: true, - pavaDrawn: true, + pavaDrawnAgainstPrisoner: true, pavaUsed: true, weaponsObserved: 'NO', guidingHold: true, @@ -645,9 +645,9 @@ describe('partial schema', () => { it('Should return no error messages when dependent answers are absent', () => { const { errors, formResponse } = check({ - batonDrawn: 'true', + batonDrawnAgainstPrisoner: 'true', bodyWornCamera: 'YES', - pavaDrawn: 'true', + pavaDrawnAgainstPrisoner: 'true', guidingHold: 'true', escortingHold: 'true', restraintPositions: 'NONE', @@ -656,11 +656,11 @@ describe('partial schema', () => { expect(errors).toEqual([]) expect(formResponse).toEqual({ - batonDrawn: true, + batonDrawnAgainstPrisoner: true, bodyWornCamera: 'YES', guidingHold: true, escortingHold: true, - pavaDrawn: true, + pavaDrawnAgainstPrisoner: true, restraintPositions: 'NONE', weaponsObserved: 'YES', }) diff --git a/server/data/UseOfForceReport.ts b/server/data/UseOfForceReport.ts index 83b75e5e..569985e6 100644 --- a/server/data/UseOfForceReport.ts +++ b/server/data/UseOfForceReport.ts @@ -10,9 +10,11 @@ export type UseOfForceDetails = { bodyWornCamera?: string bodyWornCameraNumbers?: { cameraNum: string }[] personalProtectionTechniques: boolean - batonDrawn: boolean + batonDrawn?: boolean + batonDrawnAgainstPrisoner?: boolean batonUsed: boolean - pavaDrawn: boolean + pavaDrawn?: boolean + pavaDrawnAgainstPrisoner?: boolean pavaUsed: boolean weaponsObserved: string weaponTypes: { weaponType: string }[] diff --git a/server/routes/creatingReports/checkYourAnswers.test.ts b/server/routes/creatingReports/checkYourAnswers.test.ts index e0b3f386..251620d4 100644 --- a/server/routes/creatingReports/checkYourAnswers.test.ts +++ b/server/routes/creatingReports/checkYourAnswers.test.ts @@ -53,8 +53,8 @@ describe('GET /check-your-answers', () => { form: { incidentDetails: {}, useOfForceDetails: { - pavaDrawn: false, - batonDrawn: false, + pavaDrawnAgainstPrisoner: false, + batonDrawnAgainstPrisoner: false, guidingHold: false, escortingHold: false, handcuffsApplied: false, @@ -81,8 +81,8 @@ describe('GET /check-your-answers', () => { form: { incidentDetails: {}, useOfForceDetails: { - pavaDrawn: false, - batonDrawn: false, + pavaDrawnAgainstPrisoner: false, + batonDrawnAgainstPrisoner: false, guidingHold: false, handcuffsApplied: false, positiveCommunication: false, @@ -108,8 +108,8 @@ describe('GET /check-your-answers', () => { form: { incidentDetails: {}, useOfForceDetails: { - pavaDrawn: false, - batonDrawn: false, + pavaDrawnAgainstPrisoner: false, + batonDrawnAgainstPrisoner: false, guidingHold: false, handcuffsApplied: false, positiveCommunication: false, @@ -135,8 +135,8 @@ describe('GET /check-your-answers', () => { form: { incidentDetails: {}, useOfForceDetails: { - pavaDrawn: false, - batonDrawn: false, + pavaDrawnAgainstPrisoner: false, + batonDrawnAgainstPrisoner: false, guidingHold: false, handcuffsApplied: false, positiveCommunication: false, diff --git a/server/routes/creatingReports/createReport.test.ts b/server/routes/creatingReports/createReport.test.ts index 6a5efe21..ad544ae2 100644 --- a/server/routes/creatingReports/createReport.test.ts +++ b/server/routes/creatingReports/createReport.test.ts @@ -42,8 +42,8 @@ const validUseOfForceDetailsRequest = { bodyWornCameraNumbers: [{ cameraNum: 'ABC123' }], positiveCommunication: 'false', personalProtectionTechniques: 'false', - batonDrawn: 'false', - pavaDrawn: 'false', + batonDrawnAgainstPrisoner: 'false', + pavaDrawnAgainstPrisoner: 'false', weaponsObserved: 'NO', guidingHold: 'false', escortingHold: 'false', @@ -60,12 +60,12 @@ const validUseOfForceDetailUpdate = [ { bodyWornCamera: 'YES', bodyWornCameraNumbers: [{ cameraNum: 'ABC123' }], - batonDrawn: false, + batonDrawnAgainstPrisoner: false, + pavaDrawnAgainstPrisoner: false, guidingHold: false, escortingHold: false, handcuffsApplied: false, painInducingTechniquesUsed: 'NONE', - pavaDrawn: false, weaponsObserved: 'NO', personalProtectionTechniques: false, positiveCommunication: false, @@ -89,7 +89,7 @@ describe('POST save and continue /section/form', () => { test('Submitting invalid update is not allowed and user redirected to same page', () => request(app) .post(`/report/1/use-of-force-details`) - .send({ ...validUseOfForceDetailsRequest, batonDrawn: null }) + .send({ ...validUseOfForceDetailsRequest, batonDrawnAgainstPrisoner: null }) .expect(302) .expect('Location', '/report/1/use-of-force-details') .expect(() => { @@ -113,7 +113,11 @@ describe('POST save and return to tasklist', () => { test('Submitting invalid update is allowed', () => { return request(app) .post(`/report/1/use-of-force-details`) - .send({ ...validUseOfForceDetailsRequest, batonDrawn: null, bodyWornCamera: null, submitType: 'save-and-return' }) + .send({ + ...validUseOfForceDetailsRequest, + bodyWornCamera: null, + submitType: 'save-and-return', + }) .expect(302) .expect('Location', '/report/1/report-use-of-force') .expect(() => { @@ -123,7 +127,8 @@ describe('POST save and return to tasklist', () => { escortingHold: false, handcuffsApplied: false, painInducingTechniquesUsed: 'NONE', - pavaDrawn: false, + pavaDrawnAgainstPrisoner: false, + batonDrawnAgainstPrisoner: false, weaponsObserved: 'NO', personalProtectionTechniques: false, positiveCommunication: false, diff --git a/server/services/drafts/reportStatusChecker.test.ts b/server/services/drafts/reportStatusChecker.test.ts index d9fbec3f..b0f6afa6 100644 --- a/server/services/drafts/reportStatusChecker.test.ts +++ b/server/services/drafts/reportStatusChecker.test.ts @@ -13,8 +13,8 @@ describe('statusCheck', () => { involvedStaff: [], reasonsForUseOfForce: { reasons: [UofReasons.FIGHT_BETWEEN_PRISONERS.value] }, useOfForceDetails: { - pavaDrawn: false, - batonDrawn: false, + pavaDrawnAgainstPrisoner: false, + batonDrawnAgainstPrisoner: false, guidingHold: false, escortingHold: false, handcuffsApplied: false, @@ -104,9 +104,9 @@ describe('statusCheck', () => { const invalidReport = { ...validReport, useOfForceDetails: { - pavaDrawn: false, + pavaDrawnAgainstPrisoner: false, restraint: false, - batonDrawn: null, + batonDrawnAgainstPrisoner: null, guidingHold: false, escortingHold: false, handcuffsApplied: null, diff --git a/server/services/reportDetailBuilder.test.ts b/server/services/reportDetailBuilder.test.ts index 08131ffe..53448a1a 100644 --- a/server/services/reportDetailBuilder.test.ts +++ b/server/services/reportDetailBuilder.test.ts @@ -108,12 +108,14 @@ describe('Build details', () => { useOfForceDetails: { bodyCameras: undefined, batonDrawn: undefined, + batonDrawnAgainstPrisoner: undefined, + pavaDrawn: undefined, + pavaDrawnAgainstPrisoner: undefined, controlAndRestraintUsed: undefined, guidingHoldUsed: undefined, escortingHoldUsed: undefined, handcuffsApplied: undefined, painInducingTechniques: undefined, - pavaDrawn: undefined, weaponsObserved: undefined, personalProtectionTechniques: undefined, positiveCommunicationUsed: undefined, diff --git a/server/services/reportSummary.ts b/server/services/reportSummary.ts index 3f2d670a..409c6fb9 100644 --- a/server/services/reportSummary.ts +++ b/server/services/reportSummary.ts @@ -65,7 +65,13 @@ const createUseOfForceDetails = ( positiveCommunicationUsed: details.positiveCommunication, personalProtectionTechniques: details.personalProtectionTechniques, batonDrawn: whenPresent(details.batonDrawn, value => (value ? wasWeaponUsed(details.batonUsed) : NO)), + batonDrawnAgainstPrisoner: whenPresent(details.batonDrawnAgainstPrisoner, value => + value ? wasWeaponUsed(details.batonUsed) : NO + ), pavaDrawn: whenPresent(details.pavaDrawn, value => (value ? wasWeaponUsed(details.pavaUsed) : NO)), + pavaDrawnAgainstPrisoner: whenPresent(details.pavaDrawnAgainstPrisoner, value => + value ? wasWeaponUsed(details.pavaUsed) : NO + ), guidingHoldUsed: whenPresent(details.guidingHold, value => value ? howManyOfficersInvolved(details.guidingHoldOfficersInvolved) : NO ), diff --git a/server/views/formPages/incident/useOfForceDetails.html b/server/views/formPages/incident/useOfForceDetails.html index 46ba3c23..70fe345f 100644 --- a/server/views/formPages/incident/useOfForceDetails.html +++ b/server/views/formPages/incident/useOfForceDetails.html @@ -60,11 +60,11 @@

{{ pageTitle }}

{{ incidentMacro.radiosWithNestedRadios({ primaryQuestion: { - text: "Was a baton drawn by anyone during this incident?", - name: "batonDrawn", - value: data.batonDrawn, + text: "Was a baton drawn against the prisoner?", + name: "batonDrawnAgainstPrisoner", + value: data.batonDrawnAgainstPrisoner, options: yesNoOptions, - errorMessage: errors | findError('batonDrawn') + errorMessage: errors | findError('batonDrawnAgainstPrisoner') }, followUpQuestion: { text: "Was it used?", @@ -81,11 +81,11 @@

{{ pageTitle }}

{{ incidentMacro.radiosWithNestedRadios({ primaryQuestion: { - text: "Was PAVA drawn by anyone during this incident?", - name: "pavaDrawn", - value: data.pavaDrawn, + text: "Was PAVA drawn against the prisoner?", + name: "pavaDrawnAgainstPrisoner", + value: data.pavaDrawnAgainstPrisoner, options: yesNoOptions, - errorMessage: errors | findError('pavaDrawn') + errorMessage: errors | findError('pavaDrawnAgainstPrisoner') }, followUpQuestion: { diff --git a/server/views/pages/reportDetailMacro.njk b/server/views/pages/reportDetailMacro.njk index 673b5f8c..39b77c42 100644 --- a/server/views/pages/reportDetailMacro.njk +++ b/server/views/pages/reportDetailMacro.njk @@ -198,6 +198,8 @@ print: print }) }} + + {% if data.useOfForceDetails.batonDrawn %} {{ reportDetailsMacros.tableRow({ label: 'Was a baton drawn by anyone during this incident?', @@ -206,6 +208,18 @@ print: print }) }} + {% else %} + {{ + reportDetailsMacros.tableRow({ + label: 'Was a baton drawn against the prisoner?', + 'data-qa': 'batonDrawnAgainstPrisoner', + dataValue: data.useOfForceDetails.batonDrawnAgainstPrisoner, + print: print + }) + }} + {% endif %} + + {% if data.useOfForceDetails.pavaDrawn %} {{ reportDetailsMacros.tableRow({ label: 'Was PAVA drawn by anyone during this incident?', @@ -214,6 +228,16 @@ print: print }) }} + {% else %} + {{ + reportDetailsMacros.tableRow({ + label: 'Was PAVA drawn against the prisoner?', + 'data-qa': 'pavaDrawnAgainstPrisoner', + dataValue: data.useOfForceDetails.pavaDrawnAgainstPrisoner, + print: print + }) + }} + {% endif %} {% if data.useOfForceDetails.weaponsObserved != undefined %} {{