Skip to content

Commit

Permalink
fix(j-s): Fix empty information in merged cases fetched for defender …
Browse files Browse the repository at this point in the history
…users (#17364)

* fix(j-s): spelling error

* fix(j-s): remove unused controller variable

* fix(j-s): add missing props to limited access case for merged cases

* fix(j-s): adjustments + fixing leftover renaming

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
thorhildurt and kodiakhq[bot] authored Jan 2, 2025
1 parent e49258c commit 78ab728
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 20 deletions.
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,
@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,
mergedCasePoliceCaseNumbers,
mergedCaseCourtCaseNumber,
mergedCaseProsecutor,
Expand Down Expand Up @@ -47,7 +47,7 @@ const InfoCardActiveIndictment: React.FC<Props> = (props) => {
policeCaseNumbers,
court,
courtCaseNumber,
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

0 comments on commit 78ab728

Please sign in to comment.