Skip to content

Commit

Permalink
VIH-10150 Fix for audio recording being set back to true when adding …
Browse files Browse the repository at this point in the history
…interpreter to Crime Crown Court (#1261)

* Fix for audio recording being set back to true when adding interpreter to Crime Crown Court

* Add extra test

* Fix sonar issues
  • Loading branch information
oliver-scott committed Sep 5, 2023
1 parent 81fca0e commit 081352b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,18 @@ describe('SummaryComponent with valid request', () => {
component.ngOnInit();
expect(component.hearing.audio_recording_required).toBe(false);
});
it('should set audio recording to false if case type is Crime Crown Court', () => {
component.hearing.case_type = component.constants.CaseTypes.CrimeCrownCourt;
component.ngOnInit();
expect(component.hearing.audio_recording_required).toBe(false);
});
it('should set audio recording to false if case type is Crime Crown Court and an interpreter is present', () => {
component.hearing.case_type = component.constants.CaseTypes.CrimeCrownCourt;
component.interpreterPresent = true;
component.isAudioRecordingRequired();
component.ngOnInit();
expect(component.hearing.audio_recording_required).toBe(false);
});
it('should display valid court address when room number is empty', () => {
component.hearing.court_room = '';
component.ngOnInit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export class SummaryComponent implements OnInit, OnDestroy {

isAudioRecordingRequired(): boolean {
// CACD hearings should always have recordings set to off
if (this.caseType === this.constants.CaseTypes.CourtOfAppealCriminalDivision) {
if (
this.caseType === this.constants.CaseTypes.CourtOfAppealCriminalDivision ||
this.caseType === this.constants.CaseTypes.CrimeCrownCourt
) {
return false;
}
// Hearings with an interpreter should always have recording set to on
Expand Down Expand Up @@ -167,7 +170,7 @@ export class SummaryComponent implements OnInit, OnDestroy {
}
this.hearing.participants.splice(indexOfParticipant, 1);
this.removeLinkedParticipant(this.selectedParticipantEmail);
this.hearing = Object.assign({}, this.hearing);
this.hearing = { ...this.hearing };
this.hearingService.updateHearingRequest(this.hearing);
this.hearingService.setBookingHasChanged(true);
this.bookingService.removeParticipantEmail();
Expand Down Expand Up @@ -436,7 +439,7 @@ export class SummaryComponent implements OnInit, OnDestroy {
}
this.participantService.removeParticipant(this.hearing, this.selectedParticipantEmail);
this.removeLinkedParticipant(this.selectedParticipantEmail);
this.hearing = Object.assign({}, this.hearing);
this.hearing = { ...this.hearing };
this.hearingService.updateHearingRequest(this.hearing);
this.hearingService.setBookingHasChanged(true);
this.bookingService.removeParticipantEmail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const Constants = {
UserRestored: 'Changes saved successfully.'
},
OtherParticipantRoles: ['Staff Member', 'Observer', 'Panel Member', 'Winger'],
CaseTypes: { CourtOfAppealCriminalDivision: 'Court of Appeal Criminal Division' }
CaseTypes: { CourtOfAppealCriminalDivision: 'Court of Appeal Criminal Division', CrimeCrownCourt: 'Crime Crown Court' }
};

/*
Expand Down

0 comments on commit 081352b

Please sign in to comment.