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

feat(j-s): Set court session type to arraignment when subpoena created #17209

Merged
merged 3 commits into from
Dec 17, 2024
Merged
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 @@ -5,6 +5,7 @@ import router from 'next/router'
import { Box, Button } from '@island.is/island-ui/core'
import * as constants from '@island.is/judicial-system/consts'
import { formatDate } from '@island.is/judicial-system/formatters'
import { CourtSessionType } from '@island.is/judicial-system/types'
import { titles } from '@island.is/judicial-system-web/messages'
import {
CourtArrangements,
Expand Down Expand Up @@ -81,23 +82,26 @@ const Subpoena: FC = () => {
return
}

// If rescheduling after the court has met, then clear the current conclusion
const clearedConclusion =
isArraignmentScheduled && workingCase.indictmentDecision
? [
{
const additionalUpdates = [
{
// This should always be an arraignment type
courtSessionType: CourtSessionType.ARRAIGNMENT,
// if the case is being rescheduled after the court has met,
// then clear the current conclusion
...(isArraignmentScheduled && workingCase.indictmentDecision
? {
indictmentDecision: null,
courtSessionType: null,
courtDate: null,
postponedIndefinitelyExplanation: null,
indictmentRulingDecision: null,
mergeCaseId: null,
force: true,
},
]
: undefined
}
: {}),
},
]

const courtDateUpdated = await sendCourtDateToServer(clearedConclusion)
const courtDateUpdated = await sendCourtDateToServer(additionalUpdates)

if (!courtDateUpdated) {
setIsCreatingSubpoena(false)
Expand Down
Loading