Skip to content

Commit

Permalink
Merge pull request #2001 from ministryofjustice/IPB-553/bug-fix
Browse files Browse the repository at this point in the history
bug fix for community with com
  • Loading branch information
kth13 authored Jun 5, 2023
2 parents 0233011 + fda4764 commit c1c1a38
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 20 deletions.
26 changes: 19 additions & 7 deletions integration_tests/integration/referral.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,29 +429,41 @@ describe('Referral form', () => {
cy.contains('[email protected]')

// Alex's risk information
cy.contains('Probation Practitioner Details')
cy.contains('Probation practitioner details')
.parent()
.next()
.should('contain', 'Name')
.should('contain', 'Victor Drake')
.contains('Change')
.should('have.attr', 'href', `/referrals/${draftReferral.id}/confirm-probation-practitioner-details`)
.should(
'have.attr',
'href',
`/referrals/${draftReferral.id}/confirm-probation-practitioner-details?amendPPDetails=true`
)

cy.contains('Probation Practitioner Details')
cy.contains('Probation practitioner details')
.parent()
.next()
.should('contain', 'Email')
.should('contain', '[email protected]')
.contains('Change')
.should('have.attr', 'href', `/referrals/${draftReferral.id}/confirm-probation-practitioner-details`)
.should(
'have.attr',
'href',
`/referrals/${draftReferral.id}/confirm-probation-practitioner-details?amendPPDetails=true`
)

cy.contains('Probation Practitioner Details')
cy.contains('Probation practitioner details')
.parent()
.next()
.should('contain', 'PDU(probation delivery unit)')
.should('contain', 'PDU (probation delivery unit)')
.should('contain', 'London')
.contains('Change')
.should('have.attr', 'href', `/referrals/${draftReferral.id}/confirm-probation-practitioner-details`)
.should(
'have.attr',
'href',
`/referrals/${draftReferral.id}/confirm-probation-practitioner-details?amendPPDetails=true`
)

//
// Alex's risk information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,27 @@ export default class CheckAllReferralInformationPresenter {
return null
}
return {
title: `Probation Practitioner Details`,
title: `Probation practitioner details`,
summary: [
{
key: 'Name',
lines: [this.referral.ppName || this.referral.ndeliusPPName || ''],
changeLink: `/referrals/${this.referral.id}/confirm-probation-practitioner-details`,
changeLink: `/referrals/${this.referral.id}/confirm-probation-practitioner-details?amendPPDetails=true`,
},
{
key: 'Email address',
lines: [this.referral.ppEmailAddress || this.referral.ndeliusPPEmailAddress || ''],
changeLink: `/referrals/${this.referral.id}/confirm-probation-practitioner-details`,
changeLink: `/referrals/${this.referral.id}/confirm-probation-practitioner-details?amendPPDetails=true`,
},
{
key: 'PDU(probation delivery unit)',
key: 'PDU (probation delivery unit)',
lines: [this.referral.ppPdu || this.referral.ndeliusPDU || ''],
changeLink: `/referrals/${this.referral.id}/confirm-probation-practitioner-details`,
changeLink: `/referrals/${this.referral.id}/confirm-probation-practitioner-details?amendPPDetails=true`,
},
{
key: 'Probation office',
lines: [this.referral.ppProbationOffice || ''],
changeLink: `/referrals/${this.referral.id}/confirm-probation-practitioner-details`,
changeLink: `/referrals/${this.referral.id}/confirm-probation-practitioner-details?amendPPDetails=true`,
},
],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('ConfirmProbationPractitionerDetailsForm', () => {
{
formFields: ['probation-practitioner-pdu'],
errorSummaryLinkedField: 'probation-practitioner-pdu',
message: 'Enter PDU',
message: 'Enter the PDU',
},
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ describe('ConfirmProbationPractitionerDetailsPresenter', () => {
},
probationPractitionerPduSelect: {
label: 'PDU (probation delivery input)',
hint: `Start typing, then choose from the list.`,
hint: `Start typing then choose from the list.`,
errorMessage: null,
},
probationPractitionerOfficeSelect: {
label: 'Which probation office are they in? (If known)',
hint: `Start typing, then choose from the list.`,
hint: `Start typing then choose from the list.`,
},
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ export default class ConfirmProbationPractitionerDetailsPresenter {
},
probationPractitionerPduSelect: {
label: 'PDU (probation delivery input)',
hint: `Start typing, then choose from the list.`,
hint: `Start typing then choose from the list.`,
errorMessage: this.errorMessageForField('probation-practitioner-pdu'),
},
probationPractitionerOfficeSelect: {
label: 'Which probation office are they in? (If known)',
hint: `Start typing, then choose from the list.`,
hint: `Start typing then choose from the list.`,
},
}

Expand Down
5 changes: 4 additions & 1 deletion server/routes/makeAReferral/makeAReferralController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,11 @@ export default class MakeAReferralController {
} else {
error = form.error
}
const amendPPDetails = req.query.amendPPDetails === 'true'

if (error === null) {
if (error === null && amendPPDetails) {
res.redirect(`/referrals/${req.params.id}/check-all-referral-information`)
} else if (error === null && !amendPPDetails) {
res.redirect(`/referrals/${req.params.id}/form`)
} else {
const serviceUser = await this.communityApiService.getServiceUserByCRN(referral.serviceUser.crn)
Expand Down
2 changes: 1 addition & 1 deletion server/utils/errorMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default {
confirmProbationPractitionerDetails: {
emptyRadio: 'Select yes or no',
emptyName: `Enter name of probation practitioner`,
emptyPdu: `Enter PDU`,
emptyPdu: `Enter the PDU`,
invalidEmail: `Enter an email address in the correct format`,
},
interpreterLanguageWithoutName: {
Expand Down

0 comments on commit c1c1a38

Please sign in to comment.