Skip to content

Commit

Permalink
Update TagCaseState.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
unakb committed Dec 23, 2024
1 parent e455066 commit d06f326
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,7 @@ interface Props {
defendants?: Defendant[] | null
}

const haveAllSubpoenasBeenServiced = (
defendants?: Defendant[] | null,
): boolean => {
if (!defendants) {
return false
}

const haveAllSubpoenasBeenServiced = (defendants: Defendant[]): boolean => {
return defendants.every((defendant) => {
// if at least one subpoena for each defendant was serviced, we return true
return defendant.subpoenas?.some((subpoena) =>
Expand Down Expand Up @@ -90,7 +84,7 @@ export const mapCaseStateToTagVariant = (
text: formatMessage(isCourtRole ? strings.new : strings.sent),
}
case CaseState.RECEIVED: {
if (isIndictmentCase(caseType)) {
if (isIndictmentCase(caseType) && defendants) {
if (scheduledDate && !haveAllSubpoenasBeenServiced(defendants)) {
return {
color: 'red',
Expand Down

0 comments on commit d06f326

Please sign in to comment.