Skip to content

Commit

Permalink
fix(j-s): Required Uploads (#15290)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
gudjong and kodiakhq[bot] authored Jun 20, 2024
1 parent e9628c7 commit 3da0de4
Showing 1 changed file with 46 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ const Conclusion: React.FC = () => {
const success = await setAndSendCaseToServer(
[
{
indictmentRulingDecision: selectedDecision,
indictmentDecision: IndictmentDecision.COMPLETING,
indictmentRulingDecision: selectedDecision,
force: true,
},
],
Expand Down Expand Up @@ -200,8 +200,10 @@ const Conclusion: React.FC = () => {
const updateSuccess = await setAndSendCaseToServer(
[
{
indictmentDecision: IndictmentDecision.POSTPONING,
courtDate: null,
postponedIndefinitelyExplanation: postponement?.reason,
force: true,
},
],
workingCase,
Expand Down Expand Up @@ -230,6 +232,7 @@ const Conclusion: React.FC = () => {
}
: undefined,
postponedIndefinitelyExplanation: null,
force: true,
},
],
workingCase,
Expand Down Expand Up @@ -329,55 +332,52 @@ const Conclusion: React.FC = () => {
}, [workingCase.courtDate?.date])

const stepIsValid = () => {
if (selectedAction === IndictmentDecision.POSTPONING_UNTIL_VERDICT) {
return postponement?.isSettingVerdictDate
? Boolean(courtDate?.date)
: true
} else if (!allFilesDoneOrError) {
// Do not leave any downloads unfinished
if (!allFilesDoneOrError) {
return false
} else {
switch (selectedAction) {
case IndictmentDecision.POSTPONING:
return Boolean(
postponement?.postponedIndefinitely
? postponement.reason
: courtDate?.date,
)
case IndictmentDecision.REDISTRIBUTING:
return uploadFiles.some(
(file) =>
file.category === CaseFileCategory.COURT_RECORD &&
file.status === 'done',
)
case IndictmentDecision.COMPLETING:
switch (selectedDecision) {
case CaseIndictmentRulingDecision.RULING:
case CaseIndictmentRulingDecision.DISMISSAL:
return (
uploadFiles.some(
(file) =>
file.category === CaseFileCategory.COURT_RECORD &&
file.status === 'done',
) &&
uploadFiles.some(
(file) =>
file.category === CaseFileCategory.RULING &&
file.status === 'done',
)
)
case CaseIndictmentRulingDecision.FINE:
case CaseIndictmentRulingDecision.CANCELLATION:
return uploadFiles.some(
}

switch (selectedAction) {
case IndictmentDecision.POSTPONING:
return Boolean(
postponement?.postponedIndefinitely
? postponement.reason
: courtDate?.date,
)
case IndictmentDecision.POSTPONING_UNTIL_VERDICT:
return postponement?.isSettingVerdictDate
? Boolean(courtDate?.date)
: true
case IndictmentDecision.COMPLETING:
switch (selectedDecision) {
case CaseIndictmentRulingDecision.RULING:
case CaseIndictmentRulingDecision.DISMISSAL:
return (
uploadFiles.some(
(file) =>
file.category === CaseFileCategory.COURT_RECORD &&
file.status === 'done',
) &&
uploadFiles.some(
(file) =>
file.category === CaseFileCategory.RULING &&
file.status === 'done',
)
default:
return false
}
default:
return false
}
)
case CaseIndictmentRulingDecision.FINE:
case CaseIndictmentRulingDecision.CANCELLATION:
return uploadFiles.some(
(file) =>
file.category === CaseFileCategory.COURT_RECORD &&
file.status === 'done',
)
default:
return false
}
case IndictmentDecision.REDISTRIBUTING:
return true
default:
return false
}
}

Expand Down Expand Up @@ -635,7 +635,7 @@ const Conclusion: React.FC = () => {
>
<SectionHeading
title={formatMessage(strings.courtRecordTitle)}
required={selectedAction === IndictmentDecision.REDISTRIBUTING}
required={selectedAction === IndictmentDecision.COMPLETING}
/>
<InputFileUpload
fileList={uploadFiles.filter(
Expand Down

0 comments on commit 3da0de4

Please sign in to comment.