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

chore(j-s): Fixes to ServiceRequirement NOT_REQUIRED #16305

Merged
merged 15 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -147,9 +147,10 @@ export const getIndictmentInfo = (

const verdictInfo = defendants?.map<[boolean, Date | undefined]>(
(defendant) => [
rulingDecision === CaseIndictmentRulingDecision.RULING &&
defendant.serviceRequirement !== ServiceRequirement.NOT_REQUIRED,
defendant.verdictViewDate
rulingDecision === CaseIndictmentRulingDecision.RULING,
defendant.serviceRequirement === ServiceRequirement.NOT_REQUIRED
? new Date()
: defendant.verdictViewDate
? new Date(defendant.verdictViewDate)
: undefined,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
isRequestCase,
isRestrictionCase,
RequestSharedWithDefender,
ServiceRequirement,
UserRole,
} from '@island.is/judicial-system/types'

Expand Down Expand Up @@ -289,21 +288,19 @@ const canPrisonAdminUserAccessCase = (
) {
return false
}
}

// Check defendant verdict appeal deadline access
const verdictInfo = theCase.defendants?.map<[boolean, Date | undefined]>(
(defendant) => [
defendant.serviceRequirement !== ServiceRequirement.NOT_REQUIRED,
defendant.verdictViewDate,
],
)
// Check defendant verdict appeal deadline access
const canAppealVerdict = true
const verdictInfo = (theCase.defendants || []).map<
[boolean, Date | undefined]
>((defendant) => [canAppealVerdict, defendant.verdictViewDate])

const [_, indictmentVerdictAppealDeadlineExpired] =
getIndictmentVerdictAppealDeadlineStatus(verdictInfo)
const [_, indictmentVerdictAppealDeadlineExpired] =
getIndictmentVerdictAppealDeadlineStatus(verdictInfo)

if (!indictmentVerdictAppealDeadlineExpired) {
return false
}
if (!indictmentVerdictAppealDeadlineExpired) {
return false
}

return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ const getPrisonAdminUserCasesQueryFilter = (): WhereOptions => {
[Op.notIn]: Sequelize.literal(`
(SELECT case_id
FROM defendant
WHERE service_requirement <> 'NOT_REQUIRED'
AND (verdict_view_date IS NULL OR verdict_view_date > NOW() - INTERVAL '28 days'))
WHERE (verdict_view_date IS NULL OR verdict_view_date > NOW() - INTERVAL '28 days'))
`),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,7 @@ describe('getCasesQueryFilter', () => {
[Op.notIn]: Sequelize.literal(`
(SELECT case_id
FROM defendant
WHERE service_requirement <> 'NOT_REQUIRED'
AND (verdict_view_date IS NULL OR verdict_view_date > NOW() - INTERVAL '28 days'))
WHERE (verdict_view_date IS NULL OR verdict_view_date > NOW() - INTERVAL '28 days'))
`),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
Header,
Inject,
Param,
Query,
Res,
UseGuards,
} from '@nestjs/common'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const baseGridRow = style({
})

export const gridRow = styleVariants({
withButton: [baseGridRow, { gridTemplateColumns: '5fr 1fr' }],
withButton: [baseGridRow, { gridTemplateColumns: '5fr auto' }],
withoutButton: [baseGridRow, { gridTemplateColumns: '1fr' }],
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ const SectionHeading: FC<Props> = ({
{tooltip && ' '}
{tooltip && <Box component="span">{tooltip}</Box>}
</Text>
{description && <Text marginTop={1}>{description}</Text>}
{description && (
<Box component="span" marginTop={1}>
{description}
</Box>
)}
</Box>
)

Expand Down
Loading