Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(j-s): Fix empty information in merged cases fetched for defender users #17364

Merged
merged 6 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export class LimitedAccessCaseController {
private readonly limitedAccessCaseService: LimitedAccessCaseService,
private readonly eventService: EventService,
private readonly pdfService: PdfService,
private readonly defendantService: DefendantService,
oddsson marked this conversation as resolved.
Show resolved Hide resolved
@Inject(LOGGER_PROVIDER) private readonly logger: Logger,
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ export const include: Includeable[] = [
},
separate: true,
},
{ model: Institution, as: 'court' },
{ model: User, as: 'judge' },
{ model: Institution, as: 'prosecutorsOffice' },
],
separate: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,18 @@ query LimitedAccessCase($input: CaseQueryInput!) {
}
policeCaseNumbers
indictmentSubtypes
court {
id
name
}
judge {
id
name
}
prosecutorsOffice {
id
name
}
}
hasCivilClaims
civilClaimants {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const InfoCardActiveIndictment: React.FC<Props> = (props) => {
prosecutor,
policeCaseNumbers,
court,
offences,
offenses,
oddsson marked this conversation as resolved.
Show resolved Hide resolved
mergedCasePoliceCaseNumbers,
mergedCaseCourtCaseNumber,
mergedCaseProsecutor,
Expand Down Expand Up @@ -45,7 +45,7 @@ const InfoCardActiveIndictment: React.FC<Props> = (props) => {
prosecutor(workingCase.type),
policeCaseNumbers,
court,
offences,
offenses,
],
columns: 2,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const InfoCardClosedIndictment: FC<Props> = (props) => {
court,
prosecutor,
judge,
offence,
offense,
indictmentReviewer,
indictmentReviewDecision,
indictmentReviewedDate,
Expand Down Expand Up @@ -67,7 +67,7 @@ const InfoCardClosedIndictment: FC<Props> = (props) => {
court,
prosecutor(workingCase.type),
judge,
offence,
offense,
],
columns: 2,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const strings = defineMessages({
defaultMessage: 'Ákærandi',
description: 'Notaður sem titill á "ákærandi" hluta af yfirliti ákæru.',
},
offence: {
id: 'judicial.system.core:info_card_indictment.offence',
offense: {
id: 'judicial.system.core:info_card_indictment.offense',
defaultMessage: 'Brot',
description: 'Notaður sem titill á "brot" hluta af yfirliti ákæru.',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ const useInfoCardItems = () => {
values: [workingCase.courtCaseNumber],
}

const offences: Item = {
id: 'offences-item',
title: formatMessage(strings.offence),
const offenses: Item = {
id: 'offenses-item',
title: formatMessage(strings.offense),
values: [
<>
{readableIndictmentSubtypes(
Expand Down Expand Up @@ -172,9 +172,9 @@ const useInfoCardItems = () => {
],
}

const offence: Item = {
id: 'offence-item',
title: formatMessage(strings.offence),
const offense: Item = {
id: 'offense-item',
title: formatMessage(strings.offense),
values: [
<>
{readableIndictmentSubtypes(
Expand Down Expand Up @@ -366,11 +366,11 @@ const useInfoCardItems = () => {
policeCaseNumbers,
court,
courtCaseNumber,
offences,
offenses,
judge,
caseType,
registrar,
offence,
offense,
requestedCourtDate,
mergeCase,
mergedCasePoliceCaseNumbers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const Indictment = () => {
const setDriversLicenseSuspensionRequest = useCallback(
(indictmentCounts?: TIndictmentCount[]) => {
// If the case has:
// at least one count with the offence driving under the influence of alcohol, illegal drugs or prescription drugs
// at least one count with the offense driving under the influence of alcohol, illegal drugs or prescription drugs
// then by default the prosecutor requests a suspension of the driver's licence.
const requestDriversLicenseSuspension = indictmentCounts?.some((count) =>
count.offenses?.some((offense) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('getIncidentDescriptionReason', () => {
)
})

test('should return a description with illegal drugs as third offence', () => {
test('should return a description with illegal drugs as third offense', () => {
const offenses = [
offense.DRIVING_WITHOUT_LICENCE,
offense.DRUNK_DRIVING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ const getLawsBroken = (

let lawsBroken: [number, number][] = []

offenses.forEach((offence) => {
lawsBroken = lawsBroken.concat(offenseLawsMap[offence])
offenses.forEach((offense) => {
lawsBroken = lawsBroken.concat(offenseLawsMap[offense])

if (offence === IndictmentCountOffense.DRUNK_DRIVING) {
if (offense === IndictmentCountOffense.DRUNK_DRIVING) {
lawsBroken = lawsBroken.concat(
((substances && substances.ALCOHOL) || '') >= '1,20'
? offenseLawsMap.DRUNK_DRIVING_MAJOR
Expand Down
Loading